problem with redirect rules

Hi,

I really really need your help. I'm on Ubuntu Lucid and Apache2. I enabled mod_rewrite.

One thing who is really simple usually and I would like to implement, is redirect all no www request to www request (like domain.com to www.domain.com).

Usually, it's very simple. I use .htaccess to activate this rule:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain.com$ [NC]

RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

BUT it's not working. Why why why ???? :(. All others rules are working except this rule. Perhaps I forgot something.

Thanks for your help !

Julien

4 Replies

Ah and I forgot something. I have this kind of message when I display domain.com

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

Crazy crazy crazy

Do you have a virtual host entry for domain.com pointing to the correct htdocs root?

Jon

Yes yes. I checked again and again and my virtualhost is ok.

If you wanted to give me login details, I'd be happy to take a quick look at it.

(I do freelance sysadmin work, with some linode users among my clients).

Let me know

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct