.htaccess:删除/index.php/foo

时间:2013-04-24 09:04:07

标签: .htaccess

我有一个使用Contao构建的网站。我刚打开URL重写,现在index.php/foo返回404错误。我尝试使用

/index.php/foo重写为/foo
RewriteCond %{REQUEST_URI} ^/index\.php/
RewriteRule ^index.php/(.*) /$1 [R,L]

但它没有帮助。

以下是contao factory .htaccess的重写部分,其中包含了我的全部内容(我编辑了所有评论的内容以缩短它):

<IfModule mod_rewrite.c>

  RewriteEngine On

  RewriteBase /

  RewriteCond %{REQUEST_URI} ^/index\.php/ # My rule here
  RewriteRule ^index.php/(.*) /$1 [R,L]    # My rule here

  <FilesMatch "\.(png|gif|jpe?g|js|css|ico|php|xml|csv|txt|gz|swf|flv|eot|woff|svg|ttf|htm)$">
  RewriteEngine Off
  </FilesMatch>

  RewriteRule .*\.html$ index.php [L]

  RewriteRule ^[a-z]{2}/$ index.php [L]
  RewriteRule ^([a-z]{2})$ $1/ [R=301,L]

</IfModule>

我没有到这里来的是什么?

1 个答案:

答案 0 :(得分:0)

没关系。我找到了答案。

<FilesMatch "\.(png|gif|jpe?g|js|css|ico|THIS HERE CAUSED IT: --> ***php***|xml|csv|txt|gz|swf|flv|eot|woff|svg|ttf|htm)$">
RewriteEngine Off
</FilesMatch>
相关问题