Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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'm using Apache2 on Ubuntu Lucid Lynx. I have config set to use .htaccess like normal. This is my default site:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride all
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride all
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128


I've tried lower case "all" (AllowOverride all) as well.

My .htaccess file looks like this:

//Rewrite all requests to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^ [nc]
RewriteRule ^(.*)$$1 [r=301,nc]

//301 Redirect "old_junk.html" File to "new_junk.html"
Redirect 301 /old_junk.html /new_junk.html

//301 Redirect Entire Directory "old_junk/" to "new_junk/"
RedirectMatch 301 /old_junk/(.*) /new_junk//$1

(with mydomain replaced with my actual domain... and my computer is plugged in)

share|improve this question
up vote 1 down vote accepted

Correct(add space between domain and '[NC]'):

RewriteCond %{HTTP_HOST} ^$ [NC]
share|improve this answer
thanks. I updated that, but it still doesn't work :( – orokusaki Feb 22 '11 at 14:52
@orokusaki What doesn't work? -> Do you enable rewrite(sudo a2enmod rewrite;service apache2 restart)? – ooshro Feb 22 '11 at 15:13
ah, I didn't have it enabled, but I did, and restarted, and it still doesn't work :( Could it be something in a virtual host? – orokusaki Feb 24 '11 at 14:40
@orokusaki Yes, change "AllowOverride All" – ooshro Feb 24 '11 at 14:46
I updated that (in my question also) and restarted, but still no dice :( Could it be something from another virtual-host? By the way, I'm putting the .htaccess in the web root of, not in some Apache config area. – orokusaki Feb 24 '11 at 15:17

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.