Help redirecting a url

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 11
Joined: 13 Aug 2012, 18:17

Help redirecting a url

13 Aug 2012, 18:20

Hello,

I am having difficulty redirect a URL. I think I have the wrong rewrite code.

Please see my example below and I would greatly appreciate any feed back

I would like to redirect:

OLD URL: www.mywebsite.com/page1.html
NEW URL: www.mywebsite.com/newpage.htm

What would be the correct way to do a 301 redirect?

TIA!

PS I am running Rewrite 3.0

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Help redirecting a url

14 Aug 2012, 08:11

Hello,

Try using:

Code: Select all
RewriteEngine on
RewriteBase /

Rewriterule ^page1\.html$ /newpage.htm [NC,R=301,L]


Regards
Andrew

User avatar
Posts: 11
Joined: 13 Aug 2012, 18:17

Re: Help redirecting a url

14 Aug 2012, 12:49

Hi Andrew,

Thanks a ton! The expression worked. I am however having trouble redirecting my category lists.

Here is an example:

OLD URL: https://www.mysite.com/products.int?Category=abc123

NEW URL: https://www.mysite.com/products.int?Category=def456

Below is the expression I am using, but if I request the "old" url I receive a 404:

RewriteCond %{QUERY_STRING} ^abc123$ [NC]
RewriteRule ^/products.int$ /products.int?Category=def456? [NC,R=301,L]

Can you please let me know what I am doing wrong?

TIA!

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Help redirecting a url

14 Aug 2012, 15:55

Try using more like the following:

Code: Select all
RewriteCond %{QUERY_STRING} ^Category=abc123$ [NC]
RewriteRule ^products\.int$ /products.int?Category=def456? [NC,R=301,L]


Regards
Andrew

User avatar
Posts: 11
Joined: 13 Aug 2012, 18:17

Re: Help redirecting a url

14 Aug 2012, 16:08

Hi Andrew,

I have the redirect you suggested in place, it is working, but on one particular url it will not work and I receive a 404

Here is the expression I am using:

Example1
RewriteCond %{QUERY_STRING} ^Category=LCD+DLP+TV+LAMPS$ [NC]
RewriteRule ^products\.int$ /products.int?Category=LCD+DLP+PROJECTOR+TV+LAMPS? [NC,R=301,L]

This will result in a 404

Just for testing purposes I tried the expression below and it works:

Example2
RewriteCond %{QUERY_STRING} ^Category=TESTME$ [NC]
RewriteRule ^products\.int$ /products.int?Category=LCD+DLP+PROJECTOR+TV+LAMPS? [NC,R=301,L]

Any idea why the query string TESTME in example2 works, but not the query string LCD+DLP+TVLAMPS in Example1 ?

TIA

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Help redirecting a url

15 Aug 2012, 05:02

What IIS is that?

User avatar
Posts: 11
Joined: 13 Aug 2012, 18:17

Re: Help redirecting a url

15 Aug 2012, 11:56

IIS6.0 and we are running Rewrite 3.0

TIA

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Help redirecting a url

16 Aug 2012, 04:25

I just notices that it's the same question and the same author as in topic. Please, do not duplicate the issue all over the place.

Regards
Andrew

User avatar
Posts: 11
Joined: 13 Aug 2012, 18:17

Re: Help redirecting a url

16 Aug 2012, 11:14

Hi Andrew,

My other topic you referred to is in relation to a + in url.

This particular topic has no relation to that other topic. I am looking for help on a rewrite for this topic, not dealing with + in url

TIA

User avatar
Posts: 11
Joined: 13 Aug 2012, 18:17

Re: Help redirecting a url

16 Aug 2012, 11:49

I just disabled URL scan, restarted IIS and I still can not process a url with double escaping.

Any other suggestions?

Thanks,

Aaron

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Help redirecting a url

20 Aug 2012, 10:21

Well, as lona as "query string TESTME in example2 works" and in Example 1 doesn't, it means the '+' sign in querystring parameter is not working. The rule is correct and ISAPI_Rewrite is working.

Regards
Andrew

User avatar
Posts: 11
Joined: 13 Aug 2012, 18:17

Re: Help redirecting a url

20 Aug 2012, 12:24

It seems any "test" URL I try as long as it does not double escape + works.

I completely disables URL scan, restarted IIS and still can not get these to work..

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Help redirecting a url

21 Aug 2012, 10:46

And if you disable ISAPI_Rewrite does it still gives 404 for '+' sign? If so, than it's IIS settings smowhere... or the URL_Scan is not disabled.

Regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 6 guests