Help with URL changing
5 posts
• Page 1 of 1
Help with URL changing
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.
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.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Help with URL changing
Hello,
You set up domain in a condition, not the rule:
Regards
Andrew
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
Re: Help with URL changing
Ahh, thanks!
PS: When I tried this, it is converting the hash mark to %23. Is there a way to stop that? Thanks again.
PS: When I tried this, it is converting the hash mark to %23. Is there a way to stop that? Thanks again.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Help with URL changing
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
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
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 22 guests