内部服务器错误与RewriteRule [英] Internal server error With RewriteRule

查看:63
本文介绍了内部服务器错误与RewriteRule的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题是,何时更改我的网站的网址,该网址是动态生成的.

I have a problem is when change the url of my site, which is generated dynamically.

我启用了Apache模块mod rewrite localhost wamp服务器.完美地在Fundionaba之前,但是在php url之前使用两个变量现在删除一台服务器失败.我不明白为什么会失败.你能帮我吗?

I have the Apache module mod rewrite localhost wamp server enabled. Before fundionaba perfectly, but before the php url used two variables now to remove one server fails. I do not understand why fails. Can you help me?

当您单击这些以前有效的链接时,服务器错误很奇怪.如果php变量或php错误出了问题,因为这可能会,但服务器却没有.

It is very strange that server error when you click on these same links that worked previously. If there is a problem with the php variable or php error because it would, but not a server error.

htaccess正常运行之前的规则:

htaccess rules before when it worked perfectly:

RewriteRule ^nov/([^/]*)/([^/]*)\.php$ /nov/nov.php?url=$1&url=$2 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /nov/nov\.php\?url=(.+)&url=(.+)\ HTTP/
RewriteRule ^nov/nov\.php$ /nov/%1/%2\.php? [L,R=301]

我现在通过删除一个不会产生内部服务器错误的变量来使用的规则:

Rules that I used now by removing one variable that WORKS NOT giving the Internal server error:

RewriteRule ^nov/([^/]*)\.php$ /nov/nov.php?url=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /nov/nov\.php\?url=(.+)\ HTTP/
RewriteRule ^nov/nov\.php$ /nov/%1\.php? [L,R=301]

让我们看看我是否可以说出错误的原因,我所做的就是删除其中一个变量.谢谢.

Let's see if I can say the reason for the error, all I've done is remove one of the variables. Thank you.

Apache服务器错误日志:

Apache Server error log:

[Thu Mar 03 10:17:46 2016] [error] [client ::1] 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://localhost/

推荐答案

您必须排除要重写的目标,否则将收到无限循环错误,因为/nov/nov.php?url=$1 也匹配 ^ nov/(.+).php $

You have to exclude the destination you are rewriting to othewise you will get an infinite loop error because /nov/nov.php?url=$1 also matches the pattern ^nov/(.+).php$

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /nov/nov\.php\?url=([^\s]+) [NC]
RewriteRule ^ /nov/%1.php? [L,R=301]
RewriteCond %{REQUEST_URI} !^/nov/nov\.php
RewriteRule ^nov/(.+)\.php$ /nov/nov.php?url=$1 [L]

这篇关于内部服务器错误与RewriteRule的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆