Omkar
Omkar

Reputation: 308

htaccess - displaying 500 Error even enabling the htaccess file in httpd.conf on localhost

.htaccess displaying 500 server error.
Location of file is root folder. Below is the code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule .signup.php [L]
RewriteRule .* .signup.php [PT,L]
</IfModule>

I've enabled htaccess file in httpd.conf file that is

<Directory />
  Options FollowSymLinks
  AllowOverride all
  Order deny,allow
  Deny from all
  Satisfy all
</Directory>

and

LoadModule rewrite_module modules/mod_rewrite.so

Upvotes: 2

Views: 145

Answers (1)

Ultimater
Ultimater

Reputation: 4738

Your RewriteBase line is faulty without specifying a directory.
Try either: RewriteBase / -or- removing the line entirely.
If that doesn't work, I think it would be safer to write your .htaccess file like so:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase / 

#If we're already on .signup.php, exit so we don't get stuck in a loop
    RewriteRule .signup.php - [L]

#If doesn't exist
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
#rewrite to .signup.php and read from the top of .htaccess again
    RewriteRule .* .signup.php [PT,L]
</IfModule>

That way we avoid redirection loops in case the .signup.php file doesn't exist either..
If that still doesn't work, try testing without the PT flag, it has a tendency of complicating .htaccess if you're not absolutely sure you know what you're doing.

Upvotes: 1

Related Questions