I have a master site at http://www.abc.com and a subsite at http://www.abc.com/xyz.

I want to redirect a user to the registration page of the main domain, whenever a user tries to register on the sub-domain. As they are different Drupal setups, how do I redirect a user?

  • please add your drupal version to tags
    – Yuseferi
    Commented Sep 28, 2012 at 7:54

3 Answers 3


Follow below steps to solve your issue.

  1. Install rules module in subsite.
  2. Create a rule with condition as page being viewed is user/register
  3. Add an action redirect to URL with url as main site user/register path

Other way to do is using custom module in sub site

Use hook_init in custom module

      function yourmodule_init() {
         if (arg(0) == "user" && arg(1) == "register") {
  • this worked indeed! tks!
    – Villie
    Commented Sep 28, 2012 at 8:53
  • First(using hook_init) answer not good method,after edit it , using Rules modules is good solution.
    – Yuseferi
    Commented Sep 28, 2012 at 9:54
  • @zhilevan : I am very interested to know why hook_init is not a good method ? I do felt that it's not right way of doing some times.. Can you throw some light ?
    – Anil Sagar
    Commented Sep 28, 2012 at 10:27
  • because this hook triggerd of begin of time ,in every load called.maybe you have hundered of nodes and pages ,in every load called . needs in this question is only in one page, 'user/register` why we check condition in all another pages?
    – Yuseferi
    Commented Sep 28, 2012 at 10:54
  • @zhilevan : How does rules check when to trigger the redirect condition for matching the URL in that case ? How is it different from hook_init ?
    – Anil Sagar
    Commented Sep 28, 2012 at 11:42

If you are using drupal 6 ,you can use Path redirect ,install and enable it in your subdomain and add redirect from http://www.abc.com/xyz/user/register/ to http://www.abc.com/user/register.

and in drupal 7 you can use Global Redirect or Redirect module ,after install and enable one of them, just need set a redirection from http://www.abc.com/xyz/user/register/ to http://www.abc.com/user/register.


Try the htaccess.

# This allows you to redirect your entire website to any other domain
Redirect 301 / http://example.com/


  • The rule doesnt detect which page the user is on.
    – GoodSp33d
    Commented Sep 28, 2012 at 7:10
  • The OP doesn't want to redirect the users to the main domain all times they try to access the sub-domain, but just when they try to access the registration page.
    – apaderno
    Commented Sep 28, 2012 at 7:11
  • will it work if i write Redirect /user/register abc.com/user/register in .htaccess file? I tried it but its not working.So is this way possible?
    – Villie
    Commented Sep 28, 2012 at 7:26

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.