Kamil Imiełowski
Kamil Imiełowski

Reputation: 194

RewriteRule htaccess issue

i have live-cams.php file in root directory of my project and i try to rewrite link as /live-cams

RewriteRule ^live-cams ./live-cams.php [NC,L]

This rule throw

500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

also throw the same error when i try to open file /live-cams.php. Rule for index.php looks like to live-cams.php and it work well

RewriteRule ^home ./index.php [NC,L]

When i type friendly link as ^live-cams/ instead of ^live-cams it works.

Apache error log:

[Fri Aug 18 12:20:38.011915 2017] [core:error] [pid 14024:tid 1920] [client ::1:58474] 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.

Anyone know whats is wrong?

Upvotes: 1

Views: 16

Answers (1)

anubhava
anubhava

Reputation: 786271

You need to use anchors in your regex pattenrs:

RewriteRule ^live-cams/? live-cams.php [NC,L]

RewriteRule ^home/?$ index.php [NC,L]

Otherwise live-cams is part of your original and rewritten URIs thus causing mod_rewrite to keep executing your rules until it hits LimitInternalRecursion count.

Upvotes: 1

Related Questions