2013-10-15 42 views
0

我要實現兩件事情與我的.htaccess:的.htaccess:刪除的index.php和重定向WWW

1)從URL中刪除index.php文件(website.com/index.php/clases/到2)重定向來自website.com的所有網址 - > www.website.com

問題是:當我輸入時,website.com會將我重定向到www.website.com /index.php僅包含沒有索引的URL。

RewriteEngine on 
RewriteCond %{HTTP_HOST} !^www\. 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 

Options All -Indexes 

#RewriteBase /var/www/html/ci_yosoyprofe/ 

RewriteCond $1 !^(index\.php|js|media|uploads|assets|t|html|tmp|images|systems\/plugins|static|robots\.txt|css\/) 

RewriteRule ^(.*)$ index.php/$1 [L] 

回答

0

讓你的規則是這樣的:

Options All -Indexes 
DirectoryIndex index.php 

RewriteEngine on 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond $1 !^(index\.php|js|media|uploads|assets|t|html|tmp|images|systems/plugins|static|robots\.txt|css/) 
RewriteRule ^(.+)$ index.php/$1 [L] 
相關問題