I'm need to do the following redirects From: http://xyz.domain.com/2012/01/sample.html
To http://www.domain.com/2012/01/sample.html
and also
From: http://www.domain.com/xyz/2012/01/sample.html
To: http://www.domain.com/2012/01/sample.html
I'm pretty clueless on this, can somebody help me how to accomplish the same.
Thank.
For the first redirect:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
For the second redirect:
RewriteRule ^[^/]+/(\d{4})/(\d{2})/(.+)$ /$1/$2/$3 [L,R=301]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.