Topic: Trailing URL params messing up my rules
|

|
| Author |
|
fenrir Newbie

Joined: 31 July 2011 Location: Australia
Online Status: Offline Posts: 3
|
| Posted: 31 July 2011 at 10:35pm | IP Logged
|
|
|
Have just started working for a company that using ISAPI_Rewrite2 extensively across 80+ websites and have found that there is an issue with URL params appended from eMarketing programs and google
adwords that causes 404 errors to be thrown.
The standard set of rules at the base of the httpd.ini in every site looks like this:
# Site-wide rules for 3 CMS page levels deep
RewriteRule / /index.cfm [I,U,L]
RewriteRule /([\w-]+)/ /index.cfm\?page=$1 [I,U,L]
RewriteRule /([\w-]+)/([\w-]+)/ /index.cfm\?page=$1\&subpage=$2 [I,U,L]
RewriteRule /([\w-]+)/([\w-]+)/([\w-]+)/ /index.cfm\?page=$1\&subpage=$2\&subsubpage=$3 [I,U,L]
This works without issue for each level of nesting, however once google appends params after the trailing "/" it will throw a 404.
ie www.domain.com.au/page1/page2/?g=122r23r2
I just want to ignore the any url params at any level of the directory structure if possible.
Any help would be greatly appreciated.
Cheers
Phil
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 01 August 2011 at 12:56am | IP Logged
|
|
|
Please try to modify the config as follows:
RewriteRule /(?:\?g=.*)? /index.cfm [I,U,L]
RewriteRule /([\w-]+)/(?:\?g=.*)? /index.cfm\?page=$1 [I,U,L]
RewriteRule /([\w-]+)/([\w-]+)/(?:\?g=.*)? /index.cfm\?page=$1\&subpage=$2 [I,U,L]
RewriteRule /([\w-]+)/([\w-]+)/([\w-]+)/(?:\?g=.*)? /index.cfm\?page=$1\&subpage=$2\&subsubpage=$3 [I,U,L]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
fenrir Newbie

Joined: 31 July 2011 Location: Australia
Online Status: Offline Posts: 3
|
| Posted: 01 August 2011 at 5:55am | IP Logged
|
|
|
Brilliant thanks Anton!
|
| Back to Top |
|
| |
|
|
If you wish to post a reply to this topic you must first login
If you are not already registered you must first register
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum
|