【问题标题】:.htaccess: remove index.php and redirect www.htaccess:删除 index.php 并重定向 www
【发布时间】:2013-10-15 22:26:09
【问题描述】:

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

1) 从 URL 中删除 index.php(website.com/index.php/clases/ 到 website.com/clases/ ) 2) 重定向所有来自 website.com 的 URL -> 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]

【问题讨论】:

    标签: apache .htaccess mod-rewrite redirect


    【解决方案1】:

    你的规则是这样的:

    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]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-02-12
      • 2014-06-19
      • 1970-01-01
      • 2012-04-03
      • 1970-01-01
      • 2012-08-15
      • 1970-01-01
      相关资源
      最近更新 更多