我想用我的.htaccess实现两件事:
1)从URL中删除index.php(website.com/index.php/clases/到website.com/clases/) 2)重定向来自website.com的所有URL - > www.website.com
问题:当我进入网站时,它会将我重定向到www.website.com/index.php,只提供没有索引的网址。
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 :(得分: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]