Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's what I've come up with:</p> <pre><code>RewriteRule ^/oldpage.htm\?(.\*)(?&lt;=\?|&amp;)(?:abc=123&amp;|def=456&amp;|ghi=789&amp;)(.\*)(?&lt;=&amp;)(?:abc=123&amp;|def=456&amp;|ghi=789&amp;)(.\*)(?&lt;=&amp;)(?:(?:abc=123|def=456|ghi=789)(?:&amp;|#|$))(.\*) /newpage.htm?$1$2$3 [I,RP,L] </code></pre> <p>which I think works. the lookAhead/lookbehind qualifiers, (?&lt;= and (?= , seem to be the key to allowing me to look for the encompassing &amp; or ? without "consuming it" to mess up the next match. </p> <p>One gotcha is that if the old page url only has the three params, I still end up with a trailing ? with no parameters on the redirected url, "/newpage.htm?". I'm currently planning to avoid that by using a RewriteCond to only look at urls with 4+ params before this fires, and have a simpler match regex for the ones with exactly three..so the full ruleset comes out to:</p> <pre><code>RewriteCond URL ^/oldpage.htm\?([^#]\*=[^#]\*&amp;){3,}[^#]\*=[^#]\*.\* RewriteRule ^/oldpage.htm\?(.\*)(?&lt;=\?|&amp;)(?:abc=123&amp;|def=456&amp;|ghi=789&amp;)(.\*)(?&lt;=&amp;)(?:abc=123&amp;|def=456&amp;|ghi=789&amp;)(.\*)(?&lt;=&amp;)(?:(?:abc=123|def=456|ghi=789)(?:&amp;|#|$))(.\*) /newpage.htm?$1$2$3 [I,RP,L] RewriteRule ^/oldpage.htm\?(?:abc=123|def=456|ghi=789)&amp;(?:abc=123|def=456|ghi=789)&amp;(?:abc=123|def=456|ghi=789)(.\*) /newpage.htm$1 [I,RP,L] </code></pre> <p>(the $1 at the end is for #additions to the url...do I really need it?) The other issue is I suppose a url of /oldpage.htm?abc=123&amp;abc=123&amp;abc=123 would trigger this, but I don't see any easy way around that, and am not too worried about it..</p> <p>Can anyone think of a better way to approach this, or see any other issues?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload