Redirect subdomain to main domain except one url

Viewed 1739

Hi I have a main domain as follows

Main domain : http://www.sample.com/

Sub domain : http://dev.sample.com/

Now If any one access http://dev.sample.com/ It needs to redirect to http://www.sample.com/ So I added the following code in my sub domain It works very well

RewriteCond %{HTTP_HOST} !www.sample.com.com$ [NC]

RewriteRule ^(.*)$ http://www.sample.com.com/$1 [L,R=301]

But from subdomain if any access the following url http://dev.sample.com/data then it should not redirect to main domain. It should stay on that sub domain page. Any one have idea?

2 Answers
Related