url通过htaccess和apache屏蔽特定网址

时间:2015-09-28 16:01:16

标签: apache .htaccess

我的httpd.conf文件中有以下内容

Redirect /example /example/
ProxyPass /example/ http://localhost:1105/file/1
ProxyPassReverse /example/ http://localhost:1105/file/1

我有

www.website.com/example 

我想改成别的东西

www.website.com/somethingElse

基本上,我不想通过将其屏蔽到没有意义的名称来直接访问www.website.com/example。

<?php header(Location:www/website.com/example)?> 

会在网址中向用户显示为

www.website.com/somethingElse when loaded. 

有没有办法做到这一点,如果用户然后复制网址

www.website.com/somethingElse 

他们无法访问

www.website.com/example

1 个答案:

答案 0 :(得分:0)

简单如下:

RewriteEngine On
RewriteRule ^example$ /somethingElse [L]