简体   繁体   English

.htaccess(mod_rewrite)500内部服务器错误

[英].htaccess (mod_rewrite) 500 Internal Server Error

I have this in my .htaccess But i get 500 Internal Server Error. 我的.htaccess文件中有此文件,但出现500内部服务器错误。 I tried almost everything that i found in internet for mod_rewrite, but it still doesn't helps me. 我几乎尝试了在Internet上找到的针对mod_rewrite的所有内容,但这仍然无济于事。 How do i fix this? 我该如何解决?

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^zip/([A-Z]*)/([a-zA-Z]*)$ zip.php?state=$1&city=$2 [L,QSA]
</IfModule>

ErrorDocument 404 /404.php

FileETag MTime Size

<IfModule mod_expires.c>
    <filesmatch ".(jpg|jpeg|gif|png|ico|css|js|woff)$">
    ExpiresActive on
    ExpiresDefault "access plus 1 year"
    </filesmatch>
</IfModule>

There is issue with you mod_deflate.c Make sure the deflate module is enabled. 您有问题mod_deflate.c确保启用了deflate模块。 You can remove to make it work as shown below. 您可以删除它以使其工作,如下所示。

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^zip/([A-Z]*)/([a-zA-Z]*)$ zip.php?state=$1&city=$2 [L,QSA]

ErrorDocument 404 /404.php

FileETag MTime Size

<IfModule mod_expires.c>
    <filesmatch ".(jpg|jpeg|gif|png|ico|css|js|woff)$">
    ExpiresActive on
    ExpiresDefault "access plus 1 year"
    </filesmatch>
</IfModule>

Try surrounding all your mod_rewrite directives in an ifmodule container: 尝试将所有mod_rewrite指令包含在ifmodule容器中:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^zip/([A-Z]*)/([a-zA-Z]*)$ zip.php?state=$1&city=$2 [L,QSA]
</IfModule>

If that fixes it, then you know you don't have mod_rewrite loaded. 如果可以解决问题,则说明您没有加载mod_rewrite。 Otherwise, time to remove lines out of your htaccess file until you stop getting the 500 error. 否则,是时候从htaccess文件中删除行,直到不再收到500错误为止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM