301 redirecting broken links after moving Joomla! to subdomain and giving parent domain to Drupal7?

drupal.stackexchange https://drupal.stackexchange.com/questions/4045

  •  16-10-2019
  •  | 
  •  

Question

I've recently started doing way more Drupal development than Joomla!, and given I use my personal website as a testing platform that changes about once every few years, am trying to migrate it from Joomla! 1.5 to Drupal 7.

To this end, I've moved the entire Joomla! website to http://v3.aendrew.com and in doing so, broken all incoming links, which are now met with a Drupal install that's never heard about any of my prior content -- http://aendrew.com.

Is there any way I can do the following via Drupal 7?

  1. Detect broken incoming request (Drupal 404s)
  2. Check whether the path exists on the Joomla! subdomain.
  3. Issue a 301 redirect pointing to the Joomla! page if so; issue a 404 if not.

Thank you!

Was it helpful?

Solution

I would personally follow the steps described below:

1) Use this technique to detect the 404s and issue the redirect

2) Since you don't want to issue the redirect right away, but first check whether the URL exists in the Joomla! subdomain, you can use a function like this to determine whether the URL exists.

3) In order to determine what the URL of the incoming request was (so that you can use it to match it against the Joomla! subdomain), you can use this: $_SERVER['REDIRECT_URL']

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top