Pergunta

I have a magento store set up at www.mysite.com/store/ - this is a Magento store and I want to redirect everything to a new domain www.mysiteshop.com.

I've put a .htaccess in the root of the Magento directory so that anyone who comes to it get redirected to the new store domain.

I don't need to redirect visitors who come to www.mysite.com.

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

But I need to make some changes as to how it works.

First, if they visit www.mysite.com/shop/alarm-clock.html I need to redirect them to www.mysiteshop.com/products/alarm-clock.

I also want to still be able to access the old admin area so if I could not redirect the url www.mysite.com/shop/index.php/admin/

Foi útil?

Solução

If your htaccess file with the mysiteshop.com rule is in the /store/ directory, then you'll need to create another htaccess file in the document root (this is where you end up if you go to http://www.mysite.com/) in order to handle redirects for /shop/:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/shop/index\.php/admin
RewriteRule ^shop/(.+)\.html$ http://www.mysiteshop.com/products/$1 [L,R=301]

Or, you can place the rules in the htaccess file in the /shop/ directory:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/shop/index\.php/admin
RewriteRule ^(.+)\.html$ http://www.mysiteshop.com/products/$1 [L,R=301]
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top