Jump to content

rewrite www.


jaymc

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
https://forums.phpfreaks.com/topic/194306-rewrite-www/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.