简体   繁体   English

.htaccess重定向保留新URL中旧URL的编号

[英].htaccess redirect keeping number from old URL in new URL

I am creating a large number of 301 redirects, obviously pointing old URLs to new URLs with the following code schema in my .htaccess file: 我正在创建大量301重定向,显然是在.htaccess文件中使用以下代码模式将旧URL指向新URL:

RewriteRule ^socialhire/career--interview-advice/11/radical-thinking--market-yourself-to-a-recruiter/?$ http://www.bold-identities.com/socialhire/blog/candidate/radical-thinking--market-yourself-to-a-recruiter/  [L,R=301]

However, when I go to the old URL I am redirected here: 但是,当我转到旧的URL时,将在此处重定向:

/socialhire/blog/candidate/11/radical-thinking--market-yourself-to-a-recruiter/

Why is the redirect keeping the number from the old URL? 为什么重定向将号码从旧的URL保留下来?

I have around 2000 redirects all acting the same. 我大约有2000次重定向,所有操作均相同。 Here's a link to the whole .htaccess 这是整个.htaccess链接

This may be caused by a looping or double redirect. 这可能是由循环或双重重定向引起的。 From the Apache Docs on flags: http://httpd.apache.org/docs/current/rewrite/flags.html 从Apache Docs上的标志开始: http : //httpd.apache.org/docs/current/rewrite/flags.html

It is therefore important, if you are using RewriteRule directives in one of these contexts, that you take explicit steps to avoid rules looping, and not count solely on the [L] flag to terminate execution of a series of rules, as shown below. 因此,重要的是,如果您在其中一种上下文中使用RewriteRule指令,则应采取显式步骤来避免规则循环,而不是仅仅依靠[L]标志来终止一系列规则的执行,如下所示。 An alternative flag, [END], can be used to terminate not only the current round of rewrite processing but prevent any subsequent rewrite processing from occurring in per-directory (htaccess) context. 替代标志[END]不仅可以用于终止当前的重写处理,而且还可以防止在每个目录(htaccess)上下文中发生任何后续的重写处理。 This does not apply to new requests resulting from external redirects. 这不适用于外部重定向产生的新请求。

I would recommend using the [END] flag as well as R,L 我建议使用[END]标志以及R,L

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

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