+ -
当前位置:首页 → 问答吧 → .htaccess 301与伪静态共同存在

.htaccess 301与伪静态共同存在

时间:2011-04-15

来源:互联网

  1. <IfModule mod_rewrite.c>

  2. RewriteEngine on

  3. RewriteCond %{HTTP_HOST} ^ebaoka.com [NC]
  4. RewriteRule ^(.*)$ http://www.ebaoka.com/$1 [L,R=301]
  5. RewriteCond %{REQUEST_FILENAME} !-d
  6. RewriteCond %{REQUEST_FILENAME} !-f
  7. RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]

  8. </IfModule>
复制代码
上面是在linux下正确的配置

下面是错误的配置,之前我写成了这样
  1. <IfModule mod_rewrite.c>

  2. RewriteEngine on

  3. RewriteCond %{REQUEST_FILENAME} !-d
  4. RewriteCond %{REQUEST_FILENAME} !-f
  5. RewriteCond %{HTTP_HOST} ^ebaoka.com [NC]
  6. RewriteRule ^(.*)$ http://www.ebaoka.com/$1 [L,R=301]
  7. RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]

  8. </IfModule>
复制代码
导致所有的文件无法访问(图片、JS、CSS)

以为程序BUG查了我俩小时,害人

作者: mycn   发布时间: 2011-04-15

两个系统文件不一样的吗。。。

作者: zp113344   发布时间: 2011-09-16