重定向与Apache的mod_rewrite URLS [英] Redirect URLS with Apache mod_rewrite
问题描述
我想重定向URLS我的Apache Web服务器上接收。基本上,当我键入
I'm trying to redirecting URLS received on my Apache web server. Basically when I type
本地主机/ index.html的
localhost/index.html
我想要的网站给我重定向到一个的readme.html
文件中的的htdocs 的内部。 index.html的
和的readme.html
文件都被保存在的htdocs 的。我看了看Apache的文档,但我似乎无法得到这个工作。下面我已经包括code迄今的httpd.conf
文件中我已经写了。
I want the website to redirect me to a readme.html
file inside the htdocs. index.html
and readme.html
files both are saved in the htdocs. I looked at the Apache documentation but I cannot seem to get this working. Below I have included the code I have wrote so far inside the httpd.conf
file.
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>
我曾尝试对我的浏览器中寻找本地主机/ index.html的,然而我看到index.html页面。除非我在看它是错误的。
谢谢
I have tried on my browser looking for "localhost/index.html" , however I am seeing the index.html page. Unless I am looking at it wrong. Thanks
推荐答案
尝试了这一点。
<Directory "usr/local/apache2/htdocs">
#your other code here#
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ readme.html [R,NC]
</Directory>
它总是好的清除缓存和删除Internet临时文件。
Its always good to clear cache and delete temporary internet files.
这篇关于重定向与Apache的mod_rewrite URLS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!