2015-11-18 206 views
0

我正在尝试重定向在我的Apache Web服务器上收到的URLS。基本上,当我输入用Apache重定向URL mod_rewrite

本地主机/ index.html的

我想要的网站给我重定向到一个readme.html文件的htdocs内。 index.htmlreadme.html文件都保存在htdocs。我看了看Apache的文档,但似乎无法得到这个工作。下面我已经包含了我在httpd.conf文件中写过的代码。

DocumentRoot "usr/local/apache2/htdocs" 
<Directory "/htdocs"> 
Options FollowSymLinks 
AllowOverride None 
Order allow,deny 
allow from all 
RewriteEngine On 
RewriteBase/
RewriteRule ^index.html readme.html [PT] 
</Directory> 

我试过在浏览器中寻找“localhost/index.html”,但是我看到了index.html页面。除非我看错了。 感谢

回答

1

尝试了这一点

<Directory "usr/local/apache2/htdocs"> 
#your other code here# 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.html$ readme.html [R,NC] 
</Directory> 

它总是好的清除缓存和删除Internet临时文件。