Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all
        </Directory>

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

        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 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

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} ^mydomain.com/ [nc]
RewriteRule ^(.*)$ http://www.mydomain.com/$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

1 Answer 1

up vote 1 down vote accepted

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

RewriteCond %{HTTP_HOST} ^mydomain.com$ [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? mydomain.com -> www.mydomain.com? 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 mydomain.com, not in some Apache config area. –  orokusaki Feb 24 '11 at 15:17

Your Answer

 
discard

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.