0

我想用我的 .htaccess 实现两件事:

1)从 URL 中删除 index.php(website.com/index.php/clases/ 到 website.com/clases/) 2)从 website.com -> www.website.com 重定向所有 URL

问题是:当我输入时,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]
4

1 回答 1

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]
于 2013-10-15T22:29:53.147 回答