Php 如何在Magento 1.7.0.2中执行301重定向?

Php 如何在Magento 1.7.0.2中执行301重定向?,php,.htaccess,magento,redirect,Php,.htaccess,Magento,Redirect,我们最近将旧的Eshop从aspx技术更改为Magento 1.7.0.2 我的旧URL类似于 http://www.demostore.nl/Contact.aspx http://www.demostore.nl/category1.aspx http://www.demostore.nl/contacts http://www.demostore.nl/products-category1 现在在magento就像 http://www.demostore.nl/Contact.a

我们最近将旧的Eshop从aspx技术更改为Magento 1.7.0.2

我的旧URL类似于

http://www.demostore.nl/Contact.aspx

http://www.demostore.nl/category1.aspx
http://www.demostore.nl/contacts

http://www.demostore.nl/products-category1
现在在magento就像

http://www.demostore.nl/Contact.aspx

http://www.demostore.nl/category1.aspx
http://www.demostore.nl/contacts

http://www.demostore.nl/products-category1

你能给我举个例子,告诉我如何通过301重定向到新的Magento站点来包含我所有的旧URL吗?我假设它将在htaccess中,但我不知道如何准确地执行此操作?

将此代码放入您的
文档\u ROOT/.htaccess
文件:

RewriteEngine On


# catehory1.aspx => products-category1
RewriteRule ^(category[^.]*)\.aspx$ /products-$1 [L,R=301,NC]

# contact.aspx => contacts
RewriteCond %{REQUEST_URI} !^/category [NC]
RewriteRule ^(.+?)\.aspx$ /$1s [L,R=301,NC]

将此代码放入
文档\u ROOT/.htaccess
文件:

RewriteEngine On


# catehory1.aspx => products-category1
RewriteRule ^(category[^.]*)\.aspx$ /products-$1 [L,R=301,NC]

# contact.aspx => contacts
RewriteCond %{REQUEST_URI} !^/category [NC]
RewriteRule ^(.+?)\.aspx$ /$1s [L,R=301,NC]

谢谢你的回答。我想你建议把我所有的旧分类放在下面:#RewriteBase/magento/正确吗?是的,正确,尝试一下,如果不起作用,让我知道。我将如何转换为???(没有index.php我的意思是…)那将是
RewriteRule^Home/demo\.aspx$/[L,R=301,NC]
到目前为止它还没有使网站崩溃…不过还有一个问题。demostore.nl/wines.aspx到demostore.nl/demo-product-wines.html???谢谢你的回答。我想你建议把我所有的旧分类放在下面:#RewriteBase/magento/正确吗?是的,正确,尝试一下,如果不行,让我知道。我如何转换成???(没有index.php我的意思是…)那将是
RewriteRule^Home/demo\.aspx$/[L,R=301,NC]
到目前为止它还没有使网站崩溃…不过还有一个问题。demostore.nl/wines.aspx到demostore.nl/demo-product-wines.html???