开发者

Mod rewrite question (really a regex problem)

开发者 https://www.devze.com 2022-12-10 18:16 出处:网络
Ive started out with the most basic rewrite there is, take any request and give it to my index page: RewriteEngine On

Ive started out with the most basic rewrite there is, take any request and give it to my index page:

RewriteEngine On
RewriteRule ^.*$ index.php [L,QSA]

Im trying to change it now so lets say i have a directory called special, I actually want to be able to go to h开发者_JAVA技巧ttp://example.com/special and access whatever files are in there.

I tried this:

RewriteRule ^special/.*$ index.php [L, QSA]

but it didnt work.


Try either this:

RewriteRule !^special/ index.php [L]

Or this:

RewriteRule ^special/ - [L]
RewriteRule ^ index.php [L]


If you want this to apply to any directory, try this:

RewriteEngine On
RewriteCond %{REQUESTFILENAME}!-d 
RewriteRule ^ index.php [L]
0

精彩评论

暂无评论...
验证码 换一张
取 消