Help with URL changing

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 9
Joined: 03 Oct 2012, 11:17

Help with URL changing

09 Jun 2013, 20:16

Hi. I'm going to spend some time with docs, but I really need to get something working sooner than later. Just need to change a url, pretty simple. If www.domain.com comes in, I want it to become www.anotherdomain.com/path/tofile.htm#anchor. I thought this would work, but it doesn't:

RewriteRule (http://www.domain.com) http://www.anotherdomain.com/path/tofile.htm#anchor [NC,L]

How do I do this? Thanks!

PS, I do have the module installed and working and turned on as other rewrites made by the former webmaster work fine.

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

Re: Help with URL changing

10 Jun 2013, 01:33

Hello,

You set up domain in a condition, not the rule:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP:Host} ^www\.domain\.com$ [NC]
RewriteRule ^$ http://www.anotherdomain.com/path/tofile.htm#anchor [NC,R=301,L]


Regards
Andrew

User avatar
Posts: 9
Joined: 03 Oct 2012, 11:17

Re: Help with URL changing

11 Jun 2013, 01:25

Ahh, thanks!

PS: When I tried this, it is converting the hash mark to %23. Is there a way to stop that? Thanks again.

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

Re: Help with URL changing

11 Jun 2013, 08:52

Hello,

I don't remember which one would work, but I'd try:
a) to escape hashtag. like '\#'
b) play with NE or NU flags. One of them may work.

Regards
Andrew

User avatar
Posts: 9
Joined: 03 Oct 2012, 11:17

Re: Help with URL changing

12 Jun 2013, 01:33

Thanks, using NE did the trick!

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 22 guests