htaccess重写任何index.php / view / whatever

时间:2011-11-23 02:09:35

标签: php .htaccess

我想要

domain.com/whatever

指向

domain.com/index.php/view/whatever

用户仍会在浏览器中看到domain.com/whatever,但会在幕后浏览domain.com/index.php/view/whatever

1 个答案:

答案 0 :(得分:1)

在域

的根目录中的.htaccess文件中尝试此操作
RewriteEngine On
RewriteBase /

#for all subdomains of domain.com
RewriteCond %{HTTP_HOST} ^(.+)\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/index\.php/view.*$ [NC]
RewriteRule ^(.*)$ index.php/view/$1 [L]