Debugging .htaccess

Debugging .htaccess is at time shooting in dark. I had gone through one such day where every thing makes sense but it does not work. I had outlined the step i used to find out the bug.

Add a Garbage inside the .htaccess to see whether you get Server Error. If you get a server error it is working

<IfModule mod_rewrite.c>

#Options +FollowSymlinks

This is Garbage and should result in failure

RewriteEngine On
RewriteBase /
RewriteRule ^(.*$ /deubg.php?$1 [QSA]
</IfModule>

If you get a server error then there is some problem in the your .htaccess config. You can try the online .htaccess tool to debug the same

http://htaccess.madewithlove.be/

If you do not get a .htaccess error then .htaccess is not read by the Apache

  1. Open the Apache configuration file located at /etc/httpd/conf/httpd.conf
  2. Change AllowOveride None to AllowOveride All inside the DocumentRoot Directory Directive, normally<Directory “/var/www/html”>
This will allow the directives to be modified.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s