"Moving site location" example not working (IIS 6)

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
Posts: 4
Joined: 08 Oct 2013, 12:22

"Moving site location" example not working (IIS 6)

08 Oct 2013, 12:26

I'm testing with the "Moving site location" from the docs, which give an example of:

RewriteEngine on
#Permanent redirect to update old links
RewriteRule (.+) http://newserver.com$1 [R=301,L]



This isn't working for some reason but I'm not sure why. A test using forcing www to the URL does work, so I know ISAPI Rewrite 3 is working on the site in general. Does anything need to be added to the above to make it worki? (I replaced newserver.com with the real URL but that's the only change I made to the above)


Thanks

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

Re: "Moving site location" example not working (IIS 6)

08 Oct 2013, 20:19

Others work? And this doesn't? In the same file? Weird... The rule is okay.
We'll need to look in the logs. Please, see logging details in FAQ - http://www.helicontech.com/forum/10648-FAQ.html

Regards
Andrew

Posts: 4
Joined: 08 Oct 2013, 12:22

Re: "Moving site location" example not working (IIS 6)

09 Oct 2013, 12:51

Thanks Andrew,

Below is the sanitized verson of the log.

The .htaccess file has exactly this code (this is just for testing):

RewriteEngine on
#Permanent redirect to update old links
RewriteRule (.+) http://google.com$1 [R=301,L]



The logs seems to indicate ISAPI rewrite is trying to do something, but when I hit the web page it doesn't take me to Google's site, it shows my test home page.



(2) init rewrite engine with requested uri /
(1) Htaccess process request C:\components\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request d:\domains\redirect.xxxxxxxx.com\wwwroot\.htaccess
(3) applying pattern '(.+)' to uri ''

(2) init rewrite engine with requested uri /favicon.ico
(1) Htaccess process request C:\components\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request d:\domains\redirect.xxxxxxxx.com\wwwroot\.htaccess
(3) applying pattern '(.+)' to uri 'favicon.ico'
(1) escaping http://google.comfavicon.ico
(2) explicitly forcing redirect with http://google.comfavicon.ico
(2) internal redirect with /favicon.ico [INTERNAL REDIRECT]

(2) init rewrite engine with requested uri /
(1) Htaccess process request C:\components\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request d:\domains\redirect.xxxxxxxx.com\wwwroot\.htaccess
(3) applying pattern '(.+)' to uri ''

(2) init rewrite engine with requested uri /
(1) Htaccess process request C:\components\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request d:\domains\redirect.xxxxxxxx.com\wwwroot\.htaccess
(3) applying pattern '(.+)' to uri ''




Thanks

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

Re: "Moving site location" example not working (IIS 6)

09 Oct 2013, 13:16

The problem I see here is that you request the root of the web-site. And your rulerequesres at least one character after the root.
So all you need to do is to replace (.+) with (.*)

Regards
Andrew

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

Re: "Moving site location" example not working (IIS 6)

09 Oct 2013, 13:27

Also, I'd add '/':

RewriteRule (.*) http://google.com/$1 [R=301,L]

Posts: 4
Joined: 08 Oct 2013, 12:22

Re: "Moving site location" example not working (IIS 6)

10 Oct 2013, 12:06

Thanks Andrew

It works with the changes you recommended.

You might want to update the example in your documentation as I was using exactly that code.



Thanks again

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

Re: "Moving site location" example not working (IIS 6)

10 Oct 2013, 22:48

Not really. We used it in httpd.conf in our documentation. Here it's .htaccess. The difference is that in .htaccess "RewriteBase /" directive is on by default.

Regards
Andrew

Posts: 4
Joined: 08 Oct 2013, 12:22

Re: "Moving site location" example not working (IIS 6)

11 Oct 2013, 08:50

ok, it's just that is was on this page which is labeled as "ISAPI_Rewrite 3 Documentation"

http://www.helicontech.com/isapi_rewrit ... amples.htm

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 16 guests