开发者

Help writing an htaccess

开发者 https://www.devze.com 2023-01-11 20:52 出处:网络
I\'d like an htaccess file that would redirect all pages to my index.php so that I can开发者_Go百科 then parse the url and handle the rest. I just don\'t know how to write it.

I'd like an htaccess file that would redirect all pages to my index.php so that I can开发者_Go百科 then parse the url and handle the rest. I just don't know how to write it.

thanks


If you Google around, you'll find various way to do it. This the way I do it (same as Zend Framework).

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]

Hope it helps.


Simple example:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
0

精彩评论

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