开发者

Can I change words in a URL served by an Apache server?

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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜