I have a site that I am not sure what the domain name will eventually be when it's live, but as I am working on it I access it through a local server. One of the directories on the site needs to be redirected. To save time when the site goes live (and also just to learn how) I am trying to write a .htaccess statement that will redirect the directory regardless of what the domain name is. Currently I access the site through:
http://phuk9220/
I want this directory:
/audio/help-and-faqs/
to redirect to:
/audio/help-and-faqs/welcome/
Now, I can easily do this with:
RedirectMatch 301 ^/audio/help-and-faqs/$ http://phuk9220/audio/help-and-faqs/welcome/
However, it means changing the http://phuk9220/ to whatever domain will it will eventually be on. Is there anyway of changing the domain dynamically depending on where it actually is ?
Thanks in advance and开发者_运维知识库 if you have any questions, please ask.
Alex
Simply omitting the domain name entirely should do the redirect on the same domain that was requested.
RedirectMatch 301 ^/audio/help-and-faqs/$ /audio/help-and-faqs/welcome/
精彩评论