3

A website built in drupal now client has come back and said the url needs to direct to another address. We want to keep the site up and working for various reasons so how do I go about doing this?

  1. homepage needs to redirect to another site
  2. the existing website homepage needs to be moved to a different page /main or /homepage and accessible only thru the direct link

how do I do this?

2

They are many solution to redirect from the page.

  1. If you are using Apache you can use .htaccess to redirect the front page to a different website. This would be the faster due that is on the server level. Here is more information about redirects on Apache.

  2. If you are using Nginix here are some instructions

  3. Another option would be doing it on the theme level. If have access to the theme you can write sites/all/themes/YOURTHEME/page.tpl.php.

    <?php
       if(drupal_is_front_page()) {
         header("location: http://www.RedirectPage.com");
         exit;
       }
    ?>
    
  4. If you dont have access to the theme or to the server. The easiest way to have a redirect is by using the meta tag. You can add a block to the front page and add the following code.

         <meta http-equiv="refresh" content="10; url=http://www.RedirectPage.com/">
    

For more information about Redirect check this article.

1

Simplest way I could think to achieve this would be:

  1. Create a directory inside the webroot with the name you wish your site to have main or homepage.
  2. Copy the entire site inside this directory.
  3. Change the value of $base_url in sites > default > settings.php if it is already set.
  4. In the webroot create a index.php file and just enter the following code:

    <?php
    header('Location: http://www.example.com/');
    exit;
    ?>
    

    which will redirect the homepage of the current site to example.com

0

Go to your themes folder. i.e., sites/all/themes/YOURTHEME/page.tpl.php, Put this on top of the page.

<?php
if(drupal_is_front_page()) {
header("location: http://www.google.com");
exit;
}
?>

Or you looking for this or any else?

0

Redirect to another site using .htaccess redirect rule. About the home page to be show in another url, go and edit the node and simply change the url in the url alias.

0

Go to admin/config/system/site-information and set front page address to what you want.

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.