Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess-清除URL,500内部服务器错误_.htaccess_Loops_Redirect_Internal Server Error_Clean Urls - Fatal编程技术网

.htaccess-清除URL,500内部服务器错误

.htaccess-清除URL,500内部服务器错误,.htaccess,loops,redirect,internal-server-error,clean-urls,.htaccess,Loops,Redirect,Internal Server Error,Clean Urls,我将此作为我的.htaccess: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html #

我将此作为我的.htaccess:

RewriteEngine on 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.*)$ $1.html

# Where it's all about
RewriteRule ^users/([a-zA-Z0-9]+)$ users.php?user=$1
RewriteRule ^users/([a-zA-Z0-9]+)/$ users.php?user=$1

RewriteEngine On
RewriteCond %{HTTP_HOST}  ^www.daltonempire.nl [nocase]
RewriteRule ^(.*) 
http://daltonempire.nl/$1 [last,redirect=301]
我尝试创建干净的URL,将
daltonempire.nl/users/Me
重定向到
daltonempire.nl/users.php?user=Me

然而,我失败得很惨。我的网站现在不断返回
500内部服务器错误
。 (我可能以某种方式创建了重定向循环?)


我做错了什么?(我该怎么做才能修复它?

相信上一条规则中有一条额外的换行符。还要确保在所有规则中使用
L
(最后一个)标志

RewriteEngine on 

# Where it's all about
RewriteRule ^users/([a-zA-Z0-9]+)/?$ users.php?user=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f    
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.+?)/?$ $1.php [L]

RewriteCond %{REQUEST_FILENAME} !-f    
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.+?)/?$ $1.html [L]

RewriteCond %{HTTP_HOST} ^www\.(daltonempire\.nl)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301,NE]

相信你在上一条规则中有一个额外的换行符。还要确保在所有规则中使用
L
(最后一个)标志

RewriteEngine on 

# Where it's all about
RewriteRule ^users/([a-zA-Z0-9]+)/?$ users.php?user=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f    
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.+?)/?$ $1.php [L]

RewriteCond %{REQUEST_FILENAME} !-f    
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.+?)/?$ $1.html [L]

RewriteCond %{HTTP_HOST} ^www\.(daltonempire\.nl)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301,NE]

这确实解决了我整个网站的500错误。但是,当我转到
daltonempire.nl/users/me
(应该将我重定向到
daltonempire.nl/users.php?user=me
)时,我仍然会收到500个错误。除此之外,
L
标志还有什么作用?谢谢!(但是,
L
标志有什么作用?)不客气
L
是最后一条规则,它再次注入生成的URI供Apache评估。这确实解决了我整个网站的500错误。但是,当我转到
daltonempire.nl/users/me
(应该将我重定向到
daltonempire.nl/users.php?user=me
)时,我仍然会收到500个错误。除此之外,
L
标志还有什么作用?谢谢!(但是,
L
标志有什么作用?)不客气
L
是最后一条规则,它再次注入生成的URI供Apache评估。