如何将所有http请求从http:// localhost / site / *重定向到http:// localhost / site / admin

时间:2016-05-23 03:20:15

标签: .htaccess

http://localhost/site/contactus.php
http://localhost/site/aboutus.php
http://localhost/site/home.php

如何将所有这些请求路由到

http://localhost/site/admin/index.php

1 个答案:

答案 0 :(得分:1)

/site/.htaccess内,您可以使用以下规则:

RewriteEngine On
RewriteBase /site/

RewriteRule ^[^/]+?\.php$ admin/index.php [L,NC]