Jump to content

rewrite www.


Recommended Posts

I usually rewrite none www. urls using this method


rewritecond %{http_host} ^website.co.uk [nc]

rewriterule ^(.*)$ http://www.website.co.uk/$1 [r=301,nc]


Although that works, I need a way to do it where I do not need to statically set the domain name as the same vhost will be used for multiple deomains, hence I cant statically set the domain name as its dynamic


e.g something like this (obviously not correct syntax)


rewritecond %{http_host} ^{$DOMAIN} [nc]

rewriterule ^(.*)$ http://www.{$DOMAIN}/$1 [r=301,nc]


Any ideas how to elimate the need to statically assign url?

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.