batch .htaccess 301 redirect
I'm moving servers and cleaning up the url's a bit at the same time.
current urls are:
secure.mydomain.com/onlinestore/product.php?productid=12345
changing it to:
mydomain.com/product.php?productid=12345
wondering if I can 开发者_StackOverflow社区do something in htaccess so if someone clicks an old link/bookmark they get redirected to the new page.
Not worried about making the dynamic part be SEO friendly just yet.
Try this. It forces a redirect with a "moved permanently" header.
RewriteEngine On
RewriteCond %{HTTP_HOST} secure\.mydomain\.com
RewriteRule onlinestore/product\.php http://mydomain.com/product.php [L,R=301,QSA]
Edit was missing some /
in the RewriteCond
Edit2 Redirect wasn't going to the correct domain
精彩评论