1

I have a drupal 6 installation that is hosting numerous sites. They're all located in the sites/ folder. Like: sites/site-1 sites/site-2, etc.

One of these sites has been discontinued, and we need to redirect from it to a new domain name.

Placing a .htaccess file in the sites/site-1 folder does not work.

How can I redirect ONLY THIS ONE SITE out of a multisite installation to a new domain name?

2 Answers 2

2

In the root .htaccess file is a set of rewrite rules. You can add a rule to that to redirect to the new site.

RewriteCond %{HTTP_HOST} ^www\.olddomain\.com
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]

untested, but should be about right.

2
  • Worked! I changed www to the subdomain it was using and redirected to the new site. THANKS!
    – oranges13
    Commented May 16, 2011 at 17:12
  • When you say "root" do you mean the default folder or the root of the subsite folder? Commented Feb 24, 2013 at 1:41
1

I am guessing that you have a "mysite-1.com" folder in the /etc/apache2/sites-available directory. Basically, this is not exactly a drupal question, since the redirections can (and should -if you ask me-) be handled by the server.

Assuming that you have a specific dedicated for the site that you want to redirect, you should change it to something like this:

<VirtualHost *:80>
ServerAlias example.com 
redirect permanent / http://www.sometothersite.com/ 
</VirtualHost> 

The change should be made to the conf file where the VirtualHost directive resides (the one that is used to describe the site that you want to discontinue). Most commonly the specific directive can be found in the apache2.conf, the httpd.conf or the .htaccess file in the root of your drupal installation.

Notice, that the sample above is not the only way to do it: you can use mod_rewrite too, but keep in mind that you should do it inside the VirtualHost directive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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