0

Long story short I replaced an outdated site with a Drupal site at its previous url, let's say oldsite.org. But the old site was also accessed from oldsite.org/THIS, I think because it was a subdirectory of a larger site or something. But there are old links around that use oldsite.org/THIS and we want those to go to the homepage of the new site.

What is the proper Drupal way to do this redirect? I have thought of a handful of possible hacks, but I want to do it right. Maybe a small module to handle the redirect. Or even htaccess somehow?

2

301 redirects are considered the best way to handle redirected pages, for they inform search engines to update their databases with the new paths. Edit your .htaccess file in a text editor. [Note: Be sure to save the file in "UTF-8" format.]

In the file, you will find the commands:

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal
RewriteBase /

Immediately after that code -- and before the Drupal-provided "Rewrite old-style URLs" commands -- add your rewrite rules using the following format:

#custom redirects
RewriteRule ^old/URL/path$ http://example.com/new/path [R=301,L]
#end custom redirects

For detailed discussion https://drupal.org/node/38960

1

You can use Redirect module for this. You can set redirection path with status such as 301 etc..

For .htaccess redirect, you can take help from this documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.