I need the code for a .htaccess file that satisfies the following condition... if($url == http://jolchobi.com) { redirect to http://www.jolchobi.com } else if($url == http://jolchobi.com/*) { redirect to http://ecards.cjolchobi.com/* } i.e. in simple english... naked domain http://jolchobi.com or http://jolchobi.com/ will be redirected to http://www.jolchobi.com if there is anything after jolchobi.com, e.g. http://jolchobi.com/fairy.php or http://jolchobi.com/chobi.php?c=mhl&p=004.jpg&t=Subho+Mahalaya.+Pujo+valo+katuk. will be redirected to http://ecards.jolchobi.com/fairy.php or http://ecards.jolchobi.com/chobi.php?c=mhl&p=004.jpg&t=Subho+Mahalaya.+Pujo+valo+katuk. respectively...
not sure if it works or nor but you can try this RewriteEngine on RewriteCond %{REQUEST_URI} ^.+ [NC] RewriteRule (.*) http://ecards.jolchobi.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^jolchobi\.com [NC] RewriteRule (.*) http://www.jolchobi.com/$1 [R=301,L] Code (markup):