【发布时间】:2021-11-04 15:43:00
【问题描述】:
我需要重定向
www.monsite.fr/css
到
www.monsite.fr/index.php?p=css
在.Htaccess中
我尝试了很多在网站上找到的答案,但都没有成功:.htaccess RewriteRule for directory
我尝试在其他网站上制作正则表达式,但一旦测试它就不起作用
例子:
RewriteRule ^([^/]*)$ /index.php?p=$1 [L]
RewriteRule \/([^\/]*)$ /index.php?p=$1 [L]
RewriteRule ^([^.]+?)/?$ /index.php?p=$1 [L,QSA]
但没有任何效果。
我使用的网站告诉我这些规则可以做我想做的事:
RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?p=$1 [L]
但最后我被重定向到
www.monsite.fr/css/?p=css
怎么了?
【问题讨论】:
标签: .htaccess url-rewriting http-redirect