tags:

views:

2218

answers:

2

I'm a self-taught coder and I like to debug by echoing suspicious variables and commenting out code.

Lately, I've had to learn more about the .htaccess file. I need it to do things like interpret php scripts as php5, url rewriting, limit file upload size etc.... I have a lot of trouble debugging a .htaccess file. I often have to migrate PHP applications from one shared hosting environment to another. Sometimes this breaks the .htaccess file (or instead, something in the .htaccess file breaks the site). I check to make sure domain names are updated.

Are there popular techniques for debugging a .htaccess file? Is it just look in the apache logs? Anything else?

+1  A: 

Looking in the apache logs is the easiest way to debug .htaccess imho (adding rewriteLog Directive if necessary)

About migrating: if you are not using any physical file paths inside .htaccess (i.e. /var/www/site/script.php) they should be working without problems. If this is not the case, first try to remove all options and leave only redirect directives, in this mode you can see if it's problem with server configuration which denies rewriting of default settings.

Some reference

Alekc
A: 

Check this for an idea about debugging .htaccess file. Check the quoted block.

PradeepKr