简体   繁体   中英

.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:

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:

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

Why is the redirect keeping the number from the old URL?

I have around 2000 redirects all acting the same. Here's a link to the whole .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

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. 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. This does not apply to new requests resulting from external redirects.

I would recommend using the [END] flag as well as R,L

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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