代码之家  ›  专栏  ›  技术社区  ›  apnerve sendler

编辑.htaccess文件

  •  3
  • apnerve sendler  · 技术社区  · 15 年前

    我已经使用CodeIgniter制作了一个应用程序,并尝试使用apache mod_重写规则,如 CodeIgniter User Guide 详情如下:

    RewriteEngine on
    
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    
    RewriteRule ^(.*)$ /index.php/$1 [L]
    

    abc/ ,但当我打字时 mysite/abc/something mysite/abc/index.php/something )我被重定向到 mysite/index.php/something

    我应该对 .htaccess 文件以使其正常工作?

    2 回复  |  直到 6 年前
        1
  •  3
  •   chaos    15 年前
    RewriteCond $1 !(index\.php|^images|^robots\.txt)
    RewriteRule (.*) index.php/$1 [L,NS]
    
        2
  •  1
  •   Gumbo    15 年前

    尝试在替换中使用相对路径:

    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteRule ^(.*)$ index.php/$1 [L]