query string

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 13
Joined: 04 Jun 2012, 15:17

query string

04 Jun 2012, 15:32

Hi, I'm trying to redirect a query string from http://framoeng.no/?page=136&show=254.aspx to http://www.slb.com/services/subsea/subs ... tcher.aspx. The redirect that I created isn't working:

RewriteCond %{Query_String} ^page=136&show=254$
RewriteRule ^/$ http://www.slb.com/services/subsea/subs ... tcher.aspx? [NC,R=301,L]

What am I doing wrong?

Regards,
Emy

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: query string

05 Jun 2012, 06:05

Please try to use the following config:

RewriteBase /
RewriteCond %{QUERY_STRING} ^page=136&show=254$ [NC]
RewriteRule ^/?$ http://www.slb.com/services/subsea/subs ... tcher.aspx? [NC,R=301,L]

User avatar
Posts: 13
Joined: 04 Jun 2012, 15:17

Re: query string

05 Jun 2012, 12:51

Hi, Anton.

It didn't work.

Regards,
Emy

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: query string

06 Jun 2012, 06:51

Hello, Emy

Please enable logging in httpd.conf by putting the following lines:

RewriteLogLevel 9
LogLevel debug

And then provide error.log and rewrite.log records for your request
(http://framoeng.no/?page=136&show=254.aspx).

User avatar
Posts: 13
Joined: 04 Jun 2012, 15:17

Re: query string

11 Jun 2012, 17:42

Hi, Anton.

I've enabled the logging, but I didn't see anything related to http://framoeng.no/?page=136&show=254.aspx.

Regards,
Emy

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: query string

12 Jun 2012, 03:47

Hello, Emy

Would you please provide rewrite.log and error.log records anyway, they might still be helpful.
Also, please check the IIS log - what status is shown for the target request?
And please make sure any rules are working in the config, e.g. put the following rule on top of your config

RewriteRule testtest http://www.google.com [NC,R=301,L]

And then request www.yoursite.com/testtest. Report the result (Google page would mean it's working, while 404 will indicate some problem).

User avatar
Posts: 13
Joined: 04 Jun 2012, 15:17

Re: query string

25 Jun 2012, 16:42

Anton figured out the reason why it wasn't working.

I needed to add the following condition to the domain redirect:

RewriteCond %{QUERY_STRING} ^$

The condition checks if there's a query string in the request to the root. If it's there, the redirect to services/subsea.aspx shouldn't fire and is overridden.

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 28 guests