我要为客户实施新的设计/网站结构,但我有一点问题。由于我创建的URL有点不同,我预计由于一堆破碎的URL导致SEO排名出现问题。我的想法是将现有的URL(来自旧网站)与我创建的新URL匹配。
我偶然发现的问题如下:
旧网址与http://www.example.com/category/numeric_id-item-name_item_code.html
类似,新网址类似于http://www.example.com/item_name-item_code.
在MySQL中,我创建了一个新数据库,其中包含第一列中旧网站的item_name和item_code,第二列包含来自新数据库的相同信息。
这个想法如下:
示例:假设我们有一个名为 spring leaf 的项目,代码为 sl34 。旧网址类似http://www.example.com/springs/53-spring-leaf-sl34.html
。
为了匹配此URL,有3种可能性:
http://www.example.com/spring-leaf-sl34
http://www.example.com/iron-spring-leaf-sl34
http://www.example.com/springs
我需要有关创建这些匹配的帮助。
谢谢。
答案 0 :(得分:0)
所以,显然,我已经找到了某种快速修复方法:
CREATE
VIEW `database`.`url_view`
AS
(SELECT old_table.old_url, new_table.new_url FROM old_table LEFT JOIN new_table ON old_table.product_code=new_table.product_code);
这会将旧网址与新网址相关联,如果旧网址(产品)不再可用,则会插入一个(NULL)条目。