how to redirect all mydomain.com to www.mydomain.com i have try Options +FollowSymlinks RewriteEngine On RewriteCond %{HTTP_HOST} ^mydomain\.com [NC] RewriteRule ^(/.*) http://www.mydomain.com/$1 [L,R=301] Code (markup): it's only work for domain.com/something , not work for domain.com/forum/something TIA
Try this: Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^domain\.com RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]
This is what I use: # Redirect to WWW rewriteCond %{HTTP_HOST} !^www\.mysite\.com rewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301] Code (markup):
thanks to all replies. i have tried your suggestion but still no luck it works for example.com/forum ( no trailing slash ) but that doesn't work too for example.com/forum/showthread.php example.com/forum/ maybe need something more on rewriteRule condition? Regards
Give this a try: RewriteEngine On RewriteCond %(HTTP_HOST) !^www.mydomain.com$ [NC] RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R,L]