Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A tool to debug and test mod_rewrite (.htaccess) directives [closed]

Although being a decent web developer, I and most of my colleagues always struggle with basic tasks when using mod_rewrite.

I read the manuals and understood most of it, however most skills I've learned in life are by doing. The trouble is, there's no easy way to debug the configuration. Most of the time if I succeed at configuring the .htaccess file it's by sheer random luck not by trial and error.

I realize one can read Apache error logs or pass rewriteRule results to GET parameters and present them in say, PHP files, but that's inconvenient and slow.

So, the question. Is there a tool for writing and debugging .htaccess directives? Update: given that questions asking for libraries and similar are frequently closed as out of scope for SO, is there a more general technique for doing this?

like image 295
raveren Avatar asked Aug 05 '10 16:08

raveren


People also ask

How to Test if htaccess is working?

Save the file and type the URL yoursite.com/foobar/ . If the reditect works and the URL gets redireted to the homepage of example.com then it's clear that your htaccess is working and being read by your Apache server. If it still doesn't work then the problem might be that your hosting provider has not enabled it.

How to check htaccess?

First, visit https://htaccess.madewithlove.be. Then, enter your site's url and your . htaccess rewrite rule in the appropriate fields. Click Check Now.

What is RewriteBase?

RewriteBase is a useful server directive available for Apache web server that allows you to easily update numerous rewrite rules at one go.


1 Answers

You could use our htaccess tester. It allows you to test basic rewrite rules and conditions, we are trying to improve it's functionality over time but it does the job quite well with the current feature set.

like image 129
andreascreten Avatar answered Sep 25 '22 00:09

andreascreten