-2

I have a shop on my drupal website which we have replaced with an updated squarespace page. I need the drupal page to automatically redirect to the new shop and I can only find a help page from circa '07 which says redirects are in the works... Thanks

  • Which version of Drupal you are using? – Ajay Reddy Nov 6 '17 at 11:39
  • You could do it at the server level or use hook_init(), check the URL and use drupal_goto(). Doing it with nginx or Apache would be best in terms of performance. – Niall Murphy Nov 6 '17 at 19:07
0

You can use drupal_goto("external-path");

0

There are different ways to redirect automatically,

1) Web Server, Apache or nginx: in Apache, you can write rewrite rules() this link will help in .htaccess file which you can place in your document root. In nginx you can follow this link

2) Drupal hooks: hook_init or hook_boot, check the page URL using drupal_get_path_alias(current_path()) and use drupal_goto

3) javascript or jquery -> Add js to the respective page which you needs to redirect

Using Jquery: $(location).attr('href',url);

Using javascript: window.location.href="url";

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.