I've read all the postings I can find on 301 redirects -- and I've used .htaccess in anger on previous projects (I even know how to use mod_rewrite properly) -- so I understand how it all works with .htaccess, but...
The site I've been asked to modify (to create localisation elements into the URL so, for example, /article/hello will become uk/article/hello or fr/article/bonjour) is huge, pages are being added constantly and there will be hundreds that need 301 redirects.
Is it feasible to do a 301 redirect by re-writing the headers inside a function that detects that an article has had its URL changed and then exiting with no output? (Rather than creating a stupidly huge .htaccess file?)
All help gratefully accepted.
Comments
And the answer is
And the answer is yes.
Having investigated and made some enquiries on other boards -- there is nothing to stop me issuing a 301 redirect from inside Drupal and there's no need to touch .htaccess
It's just a matter of setting the headers correctly and exiting.
Steve
Hi Steve, I seem to know you
Hi Steve, I seem to know you from the .org.uk site ...! I posted a reponse there that may be of interest.
Also, for issuing redirects yourself, note you can use http://api.drupal.org/api/function/drupal_goto/5 (with the $http_response_code argument set to 301 or whatever you want to override the default 302).
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk