.htaccess出错导致500内部错误

时间:2013-12-20 07:15:27

标签: php apache .htaccess mod-rewrite

我想转换我的链接:

来自http://example.com/pictures.php?title=new

http://example.com/new

这是我的.htaccess;它给了我500内部服务器错误。

<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteBase /
RewriteEngine On
RewriteRule ^([^/]*)$ /pictures.php?title=$1 [L]

</IfModule>
<IfModule mod_security.c> 
   # Turn off mod_security filtering. 
   SecFilterEngine Off 

   # The below probably isn't needed, 
   # but better safe than sorry. 
   SecFilterScanPOST Off 
</IfModule>

它有什么问题?

3 个答案:

答案 0 :(得分:1)

我怀疑你的重写可能会导致循环。避免循环的RewriteCond通常是一个好主意;

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !=/pictures.php
RewriteRule ^([^/]*)$ /pictures.php?title=$1 [L]

答案 1 :(得分:0)

你可以这样试试

RewriteEngine On
RewriteRule ^([^/]*)$ /pictures.php?title=$1 [L]

答案 2 :(得分:0)

您应该避免将.js, .css and images等实际文件重新授予pictures.php。试试这个规则:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /pictures.php?title=$1 [L,QSA]