http://www.perlmonks.org?node_id=797675


in reply to (OT) mod_rewrite anyone?

Firstly, this has nothing to do with Perl.

Secondly, if you look at the docs for apache, you will find a link to the URL rewriting guide, and the second entry Canonical Hostnames explains how you would achieve this.

Clint

Replies are listed 'Best First'.
Re^2: (OT) mod_rewrite anyone?
by mrc (Sexton) on Sep 26, 2009 at 14:19 UTC
    ...and the second entry Canonical Hostnames explains how you would achieve this.
    Yes but I need a wildcard. I tried something like
    RewriteCond %{HTTP_HOST} !^www\.%1 [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/?(.*) http://www.%1/$1 [L,R,NE]
    but not working. These rules are so hard :(
A reply falls below the community's threshold of quality. You may see it by logging in.