开发者

Redirect all page requests to one page

开发者 https://www.devze.com 2022-12-09 04:47 出处:网络
I need to redirect all page requests (php, if that matters) on a specifi开发者_C百科c domain to a specific page (again, php) on that domain. I\'m looking for a .htaccess, mod_rewrite solution for easy

I need to redirect all page requests (php, if that matters) on a specifi开发者_C百科c domain to a specific page (again, php) on that domain. I'm looking for a .htaccess, mod_rewrite solution for easy of implementation.


Try this rule:

RewriteCond $1 !=index.php
RewriteRule .+\.php$ index.php [L]

That will redirect all requests that’s URL path ends in .php to the index.php in the same directory as the .htaccess file.


Something like this might do the trick:

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .* index.php/$0 [PT,L]
0

精彩评论

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