Reputation: 143
I am getting 500 Error internal with following code :
RewriteEngine On
RewriteRule ^([^/]*)$ /get.php?action=$1 [L]
The rewrite module is Active , Safe mode is OFF and there is no problem,
I tested this code :
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
But nothing changed.
What to do now ?
Upvotes: 1
Views: 6768
Reputation: 19528
It looks to me the issue is that you're not setting any limits, so it loop's your redirect.
Here is an example that would stop since the file get.php exists.
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]*)$ /get.php?action=$1 [L]
To further explain, what happens in your example is that it redirects to get.php
over and over and over, because your rule tells anything not a /
to internally redirect but not to stop if a file exits, and since get.php
also falls under your regex expression, it would redirect again.
What the 2 conditions I have added does is, it tells it to stop if a file or folder exists.
If you're using HTTPD version 2.4+ you could have simple used the flag [END]
, like this:
RewriteRule ^([^/]*)$ /get.php?action=$1 [END]
Which tells the server to stop any further redirects.
Upvotes: 3