重定向大量旧网址的新网址,最好的方法?

编程入门 行业动态 更新时间:2024-10-27 00:24:04
本文介绍了重定向大量旧网址的新网址,最好的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我们是重新构建平台的客户端,他们关心的是搜索引擎优化。他们目前的网站支持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.

更多推荐

重定向大量旧网址的新网址,最好的方法?

本文发布于:2023-10-31 18:31:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546917.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:最好的   重定向   网址   方法   新网址

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!