任何人都可以帮助我将重定向规则添加到我的.htaccess?我想根据他们输入的URL重定向网站访问者。例如:URL重定向添加到.htaccess
- 如果访问者输入URL 加www被重定向到我的根(的index.php)
- 如果访问者输入URL,但与WWW被重定向到http://domain.com/home/index.html
编辑:从你的描述的上方和下方的评论,这听起来像你想的请求是redirec如下所示:
www.domain.com -> domain.com/home/index.html www.domain.com/about.php -> domain.com/home/index.html domain.com -> domain.com/index.php domain.com/home/index.html -> domain.com/index.php domain.com/news.php?id=5 -> domain.com/index.php
如果不是,请将此编辑替换为一些更正的示例。
您希望每个请求都重定向到index.php或index.html吗?你的意思是301重定向还是你的意思是翻译? – 2009-11-10 18:02:23
我希望每个请求都被重定向。如果用户输入http://domain.com,他将被重定向到http://domain.com。如果用户输入http://www.domain.com,他将被重定向到http://domain.com/home/index.html。我的意思是301重定向。 – Bostjan 2009-11-10 18:53:44
所以我把这段代码放到我的.htaccess文件中? – Bostjan 2009-11-10 20:44:04