I have a url that looks something like: http://host.name.com/old/ and I want the new URL to be http://host.name.com/new/.
Is this easily done in Apac开发者_如何学运维he? I can't modify every link that has /old/ and I need the webserver to do this for me automatically.
This is a perfect task for mod_rewrite
. Especially see Redirecting and Remapping with mod_rewrite
).
RewriteEngine On
RewriteRule ^/old/$ /new/ [PT]
(not tested, wasn't clear if you need internal or external URL rewriting, may cause temporary blindess and abdominal distension, etc.)
精彩评论