Various times I’ve had a problem with Apache and I’ve wanted to be able to display all of the configuration files as they are seen when parsed by Apache. As I can never remember now to do it I thought I would document it here.
mod_info module can be used to do this. Just add the following to one of the hosts in your Apache configuration and then go to the
/server-info address on your server.
Deny from all
Allow from 192.168.0.1
Don’t forget to secure access to this location by IP address or other method (see deny and allow directives above).
I spent a few hours recently trying to debug some Apache Rewrite rules on our development server.
We had a particular directory outside the root of the website that I was using an Alias command to make available. However, within this directory I also wanted to apply a couple of different Rewrite rules.
A simple cachebuster
One of the rules was basically to remove instances of the string
XXXX was a number which could change (this is usually a date-stamp, such as 20130131 if modified on 31st Jan, 2013). This allows us to easily change the number in the URL which will force the browser to reload the page, avoiding possible caching problems.
will be rewritten as
To cut a long story short, I found out that mod_alias and mod_rewrite cannot be used together. Therefore, the workaround in my case was to use just mod_rewrite and use a symbolic link instead of trying to use mod_alias. Note that to allow symlinks to be use, it is also necessary to specify
Options FollowSymLinks within the Apache config for that site.
Maybe this will help someone else avoid wasting time trying to get mod_rewrite to work on top of mod_alias.