Reputation: 1405
I'm using Apache 2.4.18 with a self-signed SSL certificate (working OK) in a local virtualhost, and using this .htaccess
configuration throws HTTP 500 error:
Options +FollowSymlinks -Indexes -MultiViews
RewriteEngine on
RewriteBase /
RewriteRule ^admin/users/edit/([^/]*)$ /admin/users/edit/edit.php?user=$1 [QSA,L,NC]
The error is shown only in the "edit page", not in every page.
https://mydomain.dev/admin/users/edit/3
I've use the same rewrite logic previously without any conflict, so I can't identify the error.
The Apache SSL error log for that virtualhost has this log:
[core:error] [pid 1257] [client 127.0.0.1:50669] 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: https://mydomain.dev/admin/users/
What may be the issue?
Upvotes: 0
Views: 227
Reputation: 41219
You are getting a rewrite loop error. The problem is with your Rewrite pattern ^admin/users/edit/([^/]*)$ as it also matches the Rule's target admin/users/edit/edit.php . You need to exclude the destination path from your rule, put the following Condition above your RewriteRule line :
RewriteCond %{REQUEST_URI} !^/admin/users/edit/edit\.php$ [NC]
You can also fix it using a negitive lookahead based regex pattern :
^admin/users/edit/((?!edit\.php).*)$
Upvotes: 1