处理几千重定向用的.htaccess [英] Handling several thousand redirects with .htaccess

查看:167
本文介绍了处理几千重定向用的.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个网站大修。其结果是我提出几个页面转移到一个新的格式。他们没有保持相同的文件名之前,这样的迁移是一个有点棘手。

I am working on a site overhaul. As a result I am moving several pages over to a new format. They aren't keeping the same file name as before so the migration is a little tricky.

示例:

news.alpinezone.com/93467/变得 http://alpinezone.com/still-more-skiing-and-骑-AT-白脸/

news.alpinezone.com/93467/ is becoming http://alpinezone.com/still-more-skiing-and-riding-at-whiteface/

这个消息的子域积累了数年的超过3000篇。是否确定把3000 + 301重定向到一个的.htaccess文件

The news subdomain has accumulated in several years over 3000 articles. Is it OK to put 3000 + 301 redirects into an .htaccess file?

在一个侧面说明,正确 SEO ,我也要确保我使用http: //而不是http:// www和也确保他们完全有小写也接近了/在URL的末尾。我重新设计成字preSS和任意组合pretty的作品不多,但我明白,谷歌可以将它们视为唯一,但类似的URL的,所以我要坚持一个尽可能。

On a side note, for proper SEO, should I also make sure I use http:// instead of http:// www and also make sure they are fully lower case and also close with a / at the end of the URL. I am redesigning into wordpress and any combination pretty much works but I understand that for Google they can be considered unique but similar URL's so I want to stick with one as much as possible.

谢谢!

推荐答案

阿帕奇确实有一些东西对于这一点,像RewriteMap指令或RewriteProg。我想htaccess的文件读取每个请求,所以我不想做它的大小爆炸与3000行文字 - 尽管我的直觉告诉我,它会处理它就好了。我认为RewriteMap指令只装载一次每个服务器启动或somethign喜欢,所以那是一个好处。

Apache does have some stuff for this, like RewriteMap or RewriteProg. I think htaccess files are read on every request, so I wouldn't want to make the size of it explode with 3000 lines of text - although I gut tells me it would handle it just fine. I think RewriteMap is only loaded once per server start or somethign like that, so thats a benefit.

不过,我个人认为我只想做任何请求的消息的子域像PHP中的服务器端脚本内部重写,然后再检查URI,查询数据库,以获得最大的电流/最新网址散热片实现该ID,然后再做外部301重定向到新的URL。

But personally, I think I would just do an internal rewrite of any request to the news subdomain to a serverside script like php, and then inspect the uri, query the database to get the most current/up to date url slug for the id, and then do an external 301 redirect to the new url.

这篇关于处理几千重定向用的.htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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