簡體   English   中英

.htaccess出錯,給出500個內部錯誤

[英].htaccess getting wrong giving 500 internal error

我想這樣轉換我的鏈接:

http://example.com/pictures.php?title=newhttp://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>

怎么了

我懷疑您的重寫可能導致循環。 避免循環的RewriteCond通常是一個好主意。

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

你可以這樣簡單地嘗試

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

您應該避免將.js, .css and images類的實際文件重寫為pictures.php 嘗試以下規則:

RewriteEngine On

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM