Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having trouble getting URL rewriting to work. I have tried everything I can think of. I have checked all possible places where AllowOverride is set to None and changed it to All. mod_rewrite is itself enabled, I have restarted Apache several times. My vhost looks as below

<VirtualHost *:80>
    DocumentRoot /var/www/testRewrite

    RewriteEngine ON
    RewriteRule ^/test /TestMe.html

    <Directory /var/www/testRewrite>
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
   ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug
    RewriteLogLevel 8
    RewriteLog /var/log/rewrite.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

The request does not get forwarded to TestMe.html. The rewrite.log is empty. What am I doing wrong and how could I debug this?

share|improve this question
What ends up in your access.log? Does anything else write to that log? Do you have any other vhosts? – Ladadadada Feb 27 '13 at 21:53
I have several other virtual hosts, but they all have their own files. Only apache writes to that log and for this request I get HTTP/1.1" 404 506 – user10211 Feb 27 '13 at 22:29

Have you tried putting the rewrite rules inside the Directory section of the VirtualHost?

You might also try specifying a RewriteBase

share|improve this answer
I tried that, but it does not work. – user10211 Feb 28 '13 at 6:23

Is this within a .htaccess file? If so, you shouldn't have the initial / in the RewriteRule. That one's bitten me more than a few times.

If it's not, the first step to debugging mod_rewrite is to turn on logging. Exactly how you do this depends on if you're running apache 2.4 or one of the older ones.

You might also find some help in this list of common mod_rewrite question.

share|improve this answer
This is not within a .htaccess file. It sits in sites-available in /etc/apache2. The logging is on but besides 404, I do not get anything in the access log, the rewrite log is empty. – user10211 Feb 28 '13 at 9:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.