How do I redirect www and non but not IP

Posted by Chad T Parson on Pro Webmasters See other posts from Pro Webmasters or by Chad T Parson
Published on 2012-09-26T21:01:56Z Indexed on 2012/10/21 5:27 UTC
Read the original article Hit count: 385

I am trying to redirect www.domain.com or domain.com to www.domain.com/temp.html

I am using the following code:

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ "http\:\/\/www\.domain\.com\/temp\.html" [R=301,L]

That works however I do not want to redirect IP. So if someone types in the static IP of the domain then I do not want them to be redirected to www.domain.com/temp.html

Anyone have the code to take care of this?

© Pro Webmasters or respective owner

Related posts about htaccess

Related posts about mod-rewrite