Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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