Page 1 of 1

force link with www

Posted: Sun Apr 10, 2005 3:19 am
by hongco
how do we redirect any link to include www.
for instance, if a visitor type on the browser address: mydomain.com, mydomain.com/forums/
it will automatically redirect to http://www.mydomain.com and http://www.mydomain.com/forums, respectively?

would the mod rewrite work? and how?

Thanks! :wink:

Posted: Sun Apr 10, 2005 3:40 am
by s.dot
hmm, I do not know why you would need to do this.. but I guess that is not the point..

If it does go to your page, you could have a small script on the index that would look something like this

Code: Select all

// $path = the location typed into the address bar

if($path != &quote;http://www.domain.com&quote;){
header(&quote;Location: http://www.domain.com&quote;); }
if($path != &quote;http://www.domain.com/forums&quote;) {
header(&quote;Location: http://www.domain.com/forums&quote;); }
Not sure if that will help, but I tried my best :D

Posted: Sun Apr 10, 2005 4:46 am
by hongco
i've got the solution

Code: Select all

RewriteEngine On
RewriteCond %{HTTP_HOST} =domain.com їNC]
RewriteRule ^ http://www.domain.com%{REQUEST_URI} їR,L]
ps: weird: i posted letter R comma L but it showed up are, L :)

Jcart | Its because its our aolbonics filter. Please post your code with

Code: Select all

or

Code: Select all

tags to avoid this filter.[/color]