突然.htaccess重定向循环

时间:2017-02-09 19:59:54

标签: php apache .htaccess

这个.htaccess正在工作,直到我意外地将它改为第二个代码剪辑。当我颠倒git pull时,突然我的原始.htaccess让我内部服务器错误... apache2服务重启没有帮助。 为什么?以及如何解决?请帮忙!!!

我的重写应该

  • 删除www
  • 将IP地址重定向到网站
  • 将blog.mywebsite.be重定向到mywebsite.be/subdom/blog,但未显示已重定向。
  • 与测试相同

ORIGINAL

Options +FollowSymLinks
RewriteEngine on

ErrorDocument 403 /ErrorPages/403-error.html
ErrorDocument 404 /ErrorPages/404-error.html
ErrorDocument 500 /ErrorPages/500-error.html
ErrorDocument 502 /ErrorPages/502-error.html
ErrorDocument 503 /ErrorPages/503-error.html
ErrorDocument 504 /ErrorPages/504-error.html

RewriteBase /

RewriteCond %{HTTP_HOST} ^www.mywebsite.be
RewriteRule (.*) http://mywebsite.be/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^xx\.xx\.xx\.xxx #anonymized ip address
RewriteRule (.*) http://mywebsite.be/$1 [R=301,L]
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* ? [F,L]

RewriteCond %{HTTP_HOST} ^blog\.mywebsite\.be
RewriteRule ^(.*)$ /subdom/blog/$1 [L] 
RewriteCond %{HTTP_HOST} ^test\.mywebsite\.be
RewriteRule ^(.*)$ /subdom/blog/$1 [L] 

意外更改

RewriteEngine on


# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://example.com/folder/$1 [R=301,L]

# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ http://example.com/folder/$1 [R=301,L]

# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]

apache2 error.log

[Thu Feb 09 20:54:33.186492 2017] [core:error] [pid 888] [client xx.xxx.xxx.xxx:xxxxx] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://blog.mywebsite.be/login

0 个答案:

没有答案