1

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?

TwoStraws
  • 12,862
  • 3
  • 57
  • 71
J Esters
  • 11
  • 2
  • .htaccess files are quite finickety; sometimes rules elsewhere (if you have them) can cause problems without you realising, so I would definitely check that first. To avoid wasting time, could you please post your complete .htaccess file for us to see? – TwoStraws Dec 14 '15 at 17:53
  • I was thinking it might be a rules conflict, the file has quite a few,this is the first one i am implementing.i will need to review the file for content before posting, there are alos rules on the proxy and in apache, which are third-party managed – J Esters Dec 14 '15 at 18:27
  • It's possible this is all a red herring. Before you post the file, can you make your htaccess file just contain the rule in question to make sure the problem still occurs? That is, take out all the rules except the one that made you post this, and check if that resolves your problem. – TwoStraws Dec 14 '15 at 18:39
  • stripped out almost everything and it still occurs, might be a proxy orpache rule, this was it ` RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] RewriteRule ^sub1/(page1)(/)? sub2/$1$2 [L,QSA] ` – J Esters Dec 14 '15 at 18:47
  • Did you enable rewrite logging? – Twisty Dec 14 '15 at 21:16
  • not sure how to do that – J Esters Dec 15 '15 at 16:09
  • heard back for the host company, only thing left on the proxy server is http to https in looking over the current htacces i notice there are rules every where and custom rules are above the basic druapl rules is there a best practice doc in applying rules? the sequence of rules? I need to clean up this doc before i can do any real testing – J Esters Dec 15 '15 at 20:32

0 Answers0