简体   繁体   中英

htaccess redirect difference folder and url in folder

How i can config .htaccess like below:

Redirect "frontend" page to 404 page and redirect all url ( all file) in that "frontend" to "cms" folder:

ex: Redirect like below:

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

and:

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
.....

Thanks

This should work:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM