将目录重定向到文件.htaccess(Redirect directory to file .htaccess)
我正在尝试制作一个系统,所以这个网址:
example.com/php/get被重定向到这样的事情:
example.com/get.php所有这一切都与.htaccess
我有这个:
RewriteEngine On RewriteCond %{REQUEST_URI} ^/php/$ RewriteRule ^(.+)$ /$1.php [L,QSA]但它似乎没有工作......
I'm trying to make a system so this this url:
example.com/php/getgets redirected to something like this:
example.com/get.phpAll of this with .htaccess
I have this:
RewriteEngine On RewriteCond %{REQUEST_URI} ^/php/$ RewriteRule ^(.+)$ /$1.php [L,QSA]But it doens't seems to work...
最满意答案
尝试这个:
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/php/([^/]+)$ [NC] RewriteRule ^ /%1.php [R=301,QSA,NC,L]Try this:
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/php/([^/]+)$ [NC] RewriteRule ^ /%1.php [R=301,QSA,NC,L]更多推荐
发布评论