.htaccess - Redirect www.domain.com to sub.domain.com -


this question has answer here:

i'm trying redirect www.domain.com sub.domain.com except when url www.domain.com/something , in case keep way. couldn't find solution on google , anytime try implement in own, www.www.domain.com. in advance!

options +symlinksifownermatch options -indexes  rewriteengine on rewritecond %{http_host} !^www\. rewriterule ^(.*)$ http://www.%{http_host}/$1 [r=301,l] 

enable mod_rewrite , .htaccess through httpd.conf , put code in .htaccess under document_root directory:

options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase /  rewritecond %{http_host} ^(www\.)?domain\.com$ [nc] rewritecond %{request_uri} !^/something/?$ rewriterule ^ http://sub.domain.com%{request_uri} [r=301,l] 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -