简体   繁体   English

301将动态重定向到静态网址-Magento

[英]301 Redirect Dynamic to static URL - Magento

For the life of me and all my years of experience with .htaccess I cannot get this simple redirect to work... I am totally stumped so any help would be great; 对于我的一生以及我多年使用.htaccess的经验,我无法获得这种简单的重定向来工作...我完全迷住了,所以任何帮助都会很大。

From: http://www.offices-furniture.co.uk/pp?prod=fridgemaster-desk-fan.html 来自: http : //www.offices-furniture.co.uk/pp?prod=fridgemaster-desk-fan.html

To: http://www.offices-furniture.co.uk/fridgemaster-desk-fan.html 发送至: http : //www.offices-furniture.co.uk/fridgemaster-desk-fan.html

Should be simple, but ohhh no.. 应该很简单,但是不。

I'm using magento, own dedicated server so have full access to everything 我正在使用magento,自己的专用服务器,因此可以完全访问所有内容

Use plugin Make your transition to Magento go smoothly with this simple yet powerful URL redirect management tool. 使用插件使用此简单但功能强大的URL重定向管理工具,可以轻松过渡到Magento。

http://www.magentocommerce.com/magento-connect/smooth-move-seo-301-redirect-handler-3958.html http://www.magentocommerce.com/magento-connect/smooth-move-seo-301-redirect-handler-3958.html

http://www.mbstrategic.com/02/301-redirects-for-dynamic-urls-to-static-pages-with-htaccess/ http://www.mbstrategic.com/02/301-redirects-for-dynamic-urls-to-static-pages-with-htaccess/

301 Redirects for Dynamic URLs to Static Pages with htaccess 301使用htaccess将动态URL重定向到静态页面

Article id is necesary in htaccess, look excel table htaccess中的文章ID是必需的,请查看excel表

Finally got to the bottom of this some time later. 终于在一段时间后触底。 Basically Magento was interfering with the htaccess file, so I tested on another website; 基本上Magento会干扰htaccess文件,所以我在另一个网站上进行了测试;

http://www.office-desks.co.uk/solar-cantilever-combi-desks.html is actually loading the result from http://www.office-desks.co.uk/cat/product.php?prod=solar-cantilever-combi-desks.html http://www.office-desks.co.uk/solar-cantilever-combi-desks.html实际上是从http://www.office-desks.co.uk/cat/product.php?prod加载结果= solar-cantilever-combi-desks.html

Now I have nice clean URL's wohoo :) 现在我有一个干净的URL了:)

Here is my htaccess code which may help someone; 这是我的htaccess代码,可以帮助某人;

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ cat/product.php?prod=$1

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)\.php$ cat/cat.php?cat=$1

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([^\.]+)$ cat/cat.php?cat=$1

The lines in magento which was causing the problems was these (down to the wildcard); magento中引起问题的行是这些(直到通配符为止);

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (.*) m1_seourls.router.php

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (.*) m1_seourls.router.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM