Reputation: 115
I have a website, www.example.com And I have a third level domain, start.example.com, which redirects to
RewriteCond %{HTTP_HOST} ^start.example\.com$ [NC]
RewriteRule ^(.*)$ index.php?start=1&$1
But somehow Google included pages of the main domain to the third level domain in search, for example
start.example.com/news/
So I'd like to redirect 301 all such links to the main domain
start.example.com/news/ => www.example.com/news/
but keep the first redirect working properly.
How can I do it, help, please?
P.S. First redirect is used for statistics only, with urls like
start.example.com/?utm_source=whatever&utm_medium=start
Upvotes: 1
Views: 1538
Reputation: 785286
You can try these 2 rules:
RewriteCond %{HTTP_HOST} ^start\.example\.com$ [NC]
RewriteRule ^([^/.]*)$ index.php?start=1&$1 [L,QSA]
RewriteCond %{HTTP_HOST} ^start\.example\.com$ [NC]
RewriteRule !^index\.php$ http://www.example.com%{REQUEST_URI} [L,R=301]
Upvotes: 1