htaccess重定向差异文件夹和文件夹中的URL

时间:2015-07-16 03:45:53

标签: php .htaccess

我如何配置.htaccess如下:

重定向"前端"页面到404页面并重定向所有网址(所有文件)在"前端" to" cms"文件夹:

ex:重定向如下:

http://domain.com/frontend   -> to 404 page

http://domain.com/frontend/page1.php  -> to: http://domain.com/cms/page1.php
http://domain.com/frontend/page2.php  -> to: http://domain.com/cms/page2.php
.....

由于

1 个答案:

答案 0 :(得分:0)

这应该有效:

RewriteMatch ^/frontend/?$ /path/to/404/page.php
RewriteMatch ^/frontend/(.*) /cms/$1