Reputation: 5327
How can i update my url from htaccess file to include a string if it is not there. Before my site was developed in drupal 6 and we migrated to drupal 7. My mobile urls' got changed. For example:
http://m.example.com/en/terms-of-use to http://m.example.com/en/m-terms-of-use
http://m.example.com/en/contact-us to http://m.example.com/en/m-contact-us
Google is already indexed with my previous url's and getting 404 errors. So i planned for an auto redirection from htaccess.
How can i do this without inter-fairing the main site ie. http://example.com
Upvotes: 1
Views: 188
Reputation: 785406
You can use this rule:
RewriteCond %{HTTP_HOST} ^m\.example\.com$ [NC]
RewriteRule ^(en)/((?!m-).+)$ /$1/m-$2 [L,R=301,NC]
Upvotes: 2