重定向大量旧网址的新网址,最好的方法? [英] Best approach for redirecting a large number of old URLs to new URLs?

查看:234
本文介绍了重定向大量旧网址的新网址,最好的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们是重新构建平台的客户端,他们关心的是搜索引擎优化。他们目前的网站支持SEO友好的URL,因此不会在新的平台。因此,对于这些,我们只是要创建相同的URL映射。然而,他们有大量未搜索引擎友好,他们希望永久重定向其他URL的。这些不遵循类似的模式,所以在一个.htaccess 1正则表达式将不会削减它。什么是处理此一盏灯堆栈的最佳方式?应用程序有一个前端控制器也一样,所以我需要确保与硬重定向一起工作。

We are re-platforming for a client, and they are concerned about SEO. Their current site supports SEO friendly URLs, and so does the new platform. So for those, we are just going to create the same URL mapping. However, they have a large number of other URLs that are not SEO friendly that they want to permanently redirect. These do not follow a similar pattern, so one regex in an .htaccess won't cut it. What is the best way to handle this on a LAMP stack? The application has a front controller too, so I need to make sure that works along with the hard redirects.

推荐答案

一种方法(一的我选择)是创建旧网址和新的一个简单的表格,然后使用的 mod_rewrite的读表并执行重定向。该表能活到Apache的配置外部文件。

One approach (the one I chose) was to create a simple table of old urls and new ones, and then use mod_rewrite to read the table and perform redirects. The table can live in a file external to the Apache config.

另外,您可以编写一个脚本来查询数据库,如果你想住在一个数据库中的表。

Alternatively, you could write a script to query a database if you wanted the table to live in a database.

这意味着你要么需要手动创建映射,或写一些脚本来输出这个映射文件。

This means you either need to manually create the mapping, or write some script to output this mapping file.

这篇关于重定向大量旧网址的新网址,最好的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆