简体   繁体   中英

Internal server error With RewriteRule

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

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?

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 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 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/

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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