mod_rewrite http://localhost/home/或http://localhost/home到home.php [英] mod_rewrite http://localhost/home/ or http://localhost/home to home.php
本文介绍了mod_rewrite http://localhost/home/或http://localhost/home到home.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个非常简单的问题. 我想将所有请求重定向到 http://localhost/home/和
I've got a really simple question. I want to redirect all requests to http://localhost/home/ and http://localhost/home to home.php
我的.htaccess
文件包含:
RewriteRule ^home/$ home.php [L]
如何在URL中也没有/
的情况下使它工作?是否可以在一行中完成此操作,而不是在两条单独的行中完成该操作,例如:
How can I make it work without the /
in the url too? Is it possible to do it in one line, as opposed to two separate lines such as:
RewriteRule ^home/$ home.php
RewriteRule ^home$ home.php
谢谢:)
推荐答案
RewriteRule ^home/?$ home.php [L]
这篇关于mod_rewrite http://localhost/home/或http://localhost/home到home.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文