我想要.htaccess重写规则,但我无法弄清楚如何制作它 .
例子
www.example.com/index.php => www.example.com/index.php
www.example.com/folder/profile.php => www.example.com/profile.php
www.example.com/folder => www.example.com
一种重写规则,可以在顶级特定文件夹中提供文件,同时仍然可以提供顶级文件 .
你去吧!试试这个
编辑:进行更改以排除index.php!
RewriteEngine On RewriteCond %{REQUEST_URI} !^/folder/ RewriteRule ^(.*)$ folder/$1 [L]
我为我的Zend Framework项目做同样的事情,我将所有请求从我的http://domain.com/public/路由到http://domain.com/
要重定向文件是否不存在,请执行此操作
RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /folder/$1 [R]
2 回答
你去吧!试试这个
编辑:进行更改以排除index.php!
我为我的Zend Framework项目做同样的事情,我将所有请求从我的http://domain.com/public/路由到http://domain.com/
要重定向文件是否不存在,请执行此操作