I have created a new Drupal 8 site in a subdomain of an existing Drupal 6 site.

The new site sits in public_html/dev - so the url for it is dev.mydomain.com. What is the best way to redirect mydomain.com to dev.mydomain.com? The old files can stay where they are.

One idea is to create a new .htaccess in root containing not much more than a few rewrite rules for the subdomain. This file would replace the existing .htaccess which of course will have some settings for Drupal 6 (e.g. PHP version). Now, does this mean that the .htaccess file in the subdomain with all appropriate settings for Drupal 8 will be active? Or should I copy the subdomain .htaccess file to root and make the rewrite changes in it? I don't have access to apache files.

Any help?

  • D6 htaccess redirects all to dev.mydomain.com, D8 htaccess stays normal, that's all. – leymannx Aug 9 at 15:16
  • Thanks. That seems to work. The rewrite rules I have added are: RewriteBase /dev RewriteCond %{REQUEST_URI} !^/dev/ RedirectMatch ^/$ /dev/ I would have thought the first or second would do everything, but they don't. Without the RedirectMatch rule the top url ie www.mydomain.com does not redirect. – robusto Aug 11 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.