Forum Topic: Redirecting alias urls

Forum: .htaccess Forum : Redirecting • Posted by Jeremy Hogan • Post Date:

I haven’t finished the book, but I looked through the table of contents and didn’t see this. I probably missed it though because the book is exhaustive. (Love it btw)

I have my site at new.example.com. I have an incoming alias from example.com. I need to set up a number of permanent redirects for the incoming alias. For example, example.com/support needs to redirect to the page at new.example.com/support-services, but I want to maintain the alias. After the redirect processes, I want the URL in the browser address bar to say example.com/support-services.

Can you tell me how to do that or what page of the book covers this specifically? Also, will it work for www.example.com too? Or do I need to set up another redirect for that? Thanks for the help!

2 Replies to “Redirecting alias urls”

Posted by Jeremy Hogan •

Well, I found the answer to this. Sometimes it hurts to be such a newbie to this stuff. :) For anybody who may stumble on this, the redirect works just the same for the alias and you can use the mod_alias Redirect 301. To keep the alias URL in the browser, I just used the relative path for the URL rather than the absolute path.

Also, to fix my problem entirely, I used the serialized php replacement tool (which is amazing, but use at your own risk) to replace all instances of the subdomain with the alias.

I’m sure there’s still a way to have multiple aliases, if one wanted to and to have those aliases stay masked, but I’m not sure that’s a htaccess thing.

Posted by Jeff Starr

Hi Jeremy, glad you found a solution to this! (and thanks for the follow-up post!)