重写/(index.php)到/home/(index.php)

时间:2017-03-23 10:25:55

标签: php .htaccess mod-rewrite url-rewriting

我想将www.example.comwww.example.com/www.example.com/index.php重写为/home/

我试过了,但我得到了Internal Server Error

RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^(.*)$ /home/$1 [L]

我做错了什么?

2 个答案:

答案 0 :(得分:1)

尝试以下规则,

RewriteEngine On
RewriteCond %{REQUEST_URI} ^(/|/index.php)$
RewriteRule ^ home/ [L]

答案 1 :(得分:1)

您可以将此规则用作站点根目录中的第一个规则.htaccess:

RewriteEngine On

RewriteEngine ^/?(index\.php)?$ /home/ [L,NC]
相关问题