| 2:21 pm on Mar 8, 2013 (gmt 0)|
i would write a script to handle the redirect logic/response and then internally rewrite all requests for .cfm urls to that script.
| 2:27 pm on Mar 8, 2013 (gmt 0)|
i would also advise implementing one-to-one redirects in that script rather than redirecting large numbers of urls to a small number of hubs unless you truly believe that's the best experience for the visitor.
if you're doing it for PR reasons it won't go well.
your other option is provide a 404 or 410 response as appropriate and specify a custom error document that provides sufficient navigation and search for the visitor to find what they were hoping to see when they clicked the link to your old url.
| 2:43 pm on Mar 8, 2013 (gmt 0)|
The project is a bit of a mess - the client screwed up their redesign project and ended up ditching their developer and now upper management are riding staff members and their new agency pretty hard. We've been working with them on another capacity for a couple of years now and are trying to sort this out for them, but have limited access (took us a month to get a copy of their htaccess file for example).
It's certainly not for PR reasons, the site is pretty well established and they do loads of non SEO related marketing around the world on a regular basis (in fact non-brand search probably only accounts for 1-2% of their revenue).
In terms of legacy rankings, it was really only the location hub pages that ever ranked for anything anyway (it's hotels; the rest of the pages were just info, local fluff, etc).
Realistically given the amount of time we have to assign to the project and given what we know about the client and what they are likely to implement, it was felt a simplified htaccess solution would be best. It's easy for them to digest and the many to one redirects are decent for visitors (same language, same location, same intention behind any searches or click throughs).
We've got a phone call with their new developer next week - I'll chat with them about the script option, but tbh I can't see the client prioritising that at all.
Thanks for the input!
| 3:03 pm on Mar 8, 2013 (gmt 0)|
For the very oldest URLs, you're better off doing an internal rewrite such that when .cfm URLs are requested, a brand new PHP file is internally invoked. This logic in this file does all the fancy stuff for constructing the new URL and sending a 301 redirect out. It's important that this PHP script also correctly returns 404 status for non-valid .cfm requests. This reduces the .cfm request handling within htaccess to just a few lines. However you do it, do be aware that the 301 redirect must state both protocol and hostname as well as the new path.
| 3:19 pm on Mar 8, 2013 (gmt 0)|
Thanks g1smd, I'll discuss the script option with their developer next week.
Am I right in thinking that the existing setup (10k lines / 1.2mb) is probably causing significant server performance issues?
| 6:02 pm on Mar 8, 2013 (gmt 0)|
Not necessarily; it depends how good the code is.
If the rules are stuffed full of (.*) or (.+) elements at the beginning or in the middle of RegEx patterns, then it will be very inefficient.
| 10:41 pm on Mar 8, 2013 (gmt 0)|
RewriteRule ^/([^/]+)/pub/[^/]+/worldmap/LOCATION1/[^/]+\.cfm /$1/continent/country/location2/brand-term/overview|apercu|uebersicht/ [R=301,L]
You can't have pipes in the target. You can have them in the pattern; it's one of the most common forms of capturing:
Your first post suggests that almost everything can be done in a couple of rules with appropriate captures. That's assuming for the sake of discussion that you want to do mass redirects. Even then, 80 targets is definitely better than one single target.
| 9:55 am on Mar 11, 2013 (gmt 0)|
Given there are 3 target formats per location, that would mean I would have to do 3 rules per location (240 in total) - one each for the overview, apercu and uebersicht targets?
So the language folder ([^/]+) would be replaced with (ar|en|ru|ko|tr|zh-cn), expect for /de/ and /fr/ which would have their own rules. Would I be right in thinking it's more efficient to list the /de/ and /fr/ rules above the variable rule?
| 10:34 am on Mar 11, 2013 (gmt 0)|
Yes. You're dealing with one of the basic principles: go from most specific to most general. If you have
rule for abcdefgijkmnopqrstuvwxyz
rule for l
rule for h
list them as
blahblah (won't affect l and h, which have already been dealt with, so you don't need to mention them at all)
| 11:03 am on Mar 11, 2013 (gmt 0)|
Yes, list the more specific rule first and the most general rules last.
Make sure that every rule has the [L] flag, so that when a particular rule matches, processing stops at that rule.
| 11:16 am on Mar 11, 2013 (gmt 0)|
Thanks for the help - much appreciated! :)