Search code examples
.htaccessxampp

.htaccess causes Internal Server Error on xampp


I have .htaccess file and i write two command like that:

ReWriteRule ^member/(.*)$ /oz/photos.php?member=$1

ReWriteRule ^(.*)$ /oz/profile.php?username=$1

and this is the fault:

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at postmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

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

Apache/2.4.29 (Win32) OpenSSL/1.0.2n PHP/5.6.33 Server at localhost Port 80


Solution

  • Your rule ReWriteRule ^(.*)$ /oz/profile.php?username=$1 is looping the request every time (recursion OR redirect Loop). The all selector in rule is redirecting the redirected request too.

    try

    ReWriteRule ^member/(.*)$ /oz/photos.php?member=$1
    RewriteCond %{REQUEST_URI} !^/oz/.*
    ReWriteRule ^(.*)$ /oz/profile.php?username=$1