htaccess rewrite sometimes works sometimes does not

516 Views Asked by At

I have a rule that I need to apply in multiple instances. I'm just testing one right now, but the results are inconsistent. Here is the rule:

RewriteRule ^sub1/(pagename)(/)? sub2/$1$2 [L,QSA]

I'm not sure if the (/)? actually works; some documentation says no.

If I enter this in a new private window:

http://subserver.site.ca/sub1/mypage?utm_source=sourcePM&utm_medium=value_hidden&utm_campaign=nothing

I am redirected to this:

http://subserver.site.ca/sub2/mypage

…which is correct but the query string is no longer present. If i enter, in a new private window:

http://subserver.site.ca/sub1/mypage?utm_source=sourcePM&utm_medium=value_hidden&utm_campaign=nothing

…then i still get:

http://subserver.site.ca/sub2/mypage

If I enter the url again, in the same window:

http://subserver.site.ca/sub1/mypage?utm_source=sourcePM&utm_medium=value_hidden&utm_campaign=nothing

I get:

http://subserver.site.ca/sub2/mypage?utm_source=sourcePM&utm_medium=value_hidden&utm_campaign=nothing

…so it seems inconsistent in the way it is being applied. Do yo have any insight, or have a better rule?

0

There are 0 best solutions below