Efficient way of creating 1500 301s

I want to migrate my sites CMS but it contains 1,500 or so URLs and the format of these will change… I am happy to manually map them, but am not sure 1500 lines in the htaccess file is what you’d call efficient.

Any tips?

Thanks!

DD,

1500 lines in an .htaccess fill SHOULD cause you to be banned from your server!

There was a thread last week which discussed a RewriteMap (the correct tool but limited to those with access to httpd.conf as it can take the server down) and using a 404 script which can quickly look at your “RewriteMap-type” db table and quickly redirect using a PHP header(‘Location:…’); directive. With the problem you’ve described, either

  1. Forget about 301 redirects

  2. DON’T change the filenames (links to the CMS content)

  3. Use a RewriteMap (if available) OR

  4. Use a custom 404.PHP script to find the redirection in a db table and, if found, redirect there else redirect to your sitemap.

Regards,

DK

Interesting, never heard anything like that.

I’m not saying it doesn’t exist, it probably does, just I’m ignorant too it!

Small hijack, but I have a sizable-ish htaccess with a number of redirects, what sort of number would you consider is acceptable (assume a medium end shared/reseller server).

Thanks for the response. I’m glad I asked now :slight_smile:

I need to do something - I’d rather about the CMS change than change with nothing in place. I should say that my considerations at this point are some form of SE traffic continuity.

So 1 is out, 2 is out, 3 is out (shared hosting) and 4 would result in a 404 and not a 301.

Hmm - back to the drawing board!

Naw, you can redirect with a 301 code from PHP. Use Option 4!

Regards,

DK

rb,

Ha! That’s my typical overboard answer for everything. Saying that, though, such a large .htaccess is counterproductive and I would NOT want to share a server with someone like that!

Number? MINIMUM! You need what you need but make that a minimum as the .htaccess file must be read for EVERY request, not just your scripts, and that gets to be a massive load!

Regards,

DK

That means multiple redirects and http codes, 404 then 301 and that’s not going to work for big G as it needs to be a single clean redirect :frowning:

DD,

Trust me, SEs will not see the internal redirect on 404, only the 301 sent back with the page generated as a result of the PHP redirection. Test it if you don’t believe me!

Regards,

DK

Oh, hang on - you mean include the php in every page, pull in the URL, look it up and redirect if it matches?

Sorry, I immediately thought you meant let the 404 happen and have 404.php do the redirection.

Thanks again.

DD,

Sorry, mate, you were correct about allowing a 404 (or directing it yourself with mod_rewrite) then having PHP redirect but using the 301 in the redirect. That will be returned to browsers (et al) as a 301 with the page PHP has directed to.

Regards,

DK

Thanks David, but just so I am sure, are we saying that I can or can’t achieve a catch, lookup and 301 redirect without avoiding a 200 or 400 status code to be returned first?

If I redirect before anything is sent back to browser, I can achieve it with no 404’s I think.

Regards,

DK

Legend, thanks.