启用了mod_rewrite,但出现500个内部服务器错误

时间:2019-04-18 11:13:22

标签: .htaccess

当我从另一台服务器使用htaccess代码时,出现500内部服务器错误。只是我在新服务器上收到此错误。我与托管服务提供商进行了交谈,但他们说启用了mod_rewrite。这将来自您的htaccess代码。谁能在htaccess代码中为我做错的地方提供帮助:

# HTTPS redirect
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L]
</IfModule>

Options +FollowSymLinks -MultiViews
RewriteEngine On  
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteBase /

ErrorDocument 404 https://website.nl/not-found.php          
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC] 
RewriteRule ^ /%1 [R=302,NE,L]

RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*)index\.php$ /$1 [L,R=302,NC,NE]

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteRule ^status/([\w-]+)/?$ status.php?msgID=$1 [L,QSA]
RewriteRule ^dashboard/([\w-]+)/?$ admin/index.php?set=$1 [L,QSA]
RewriteRule ^profile/([^/]+)/?$ profile.php?username=$1 [L,QSA,NC]  
RewriteRule ^profile/(followers|friends|saved|stories)/([^/]+)/?$ $1.php?username=$2 [L,QSA,NC]

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]  
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin '*'
</IfModule>  

0 个答案:

没有答案