I am working on Drupal 9 multisite and I want split the .htaccess
file, one per site to create different redirect rules.
I know that it's possible to add all rules on drupal_root/.htaccess but I prefer to have one .htaccess
per site.
The structure is:
drupal_root/sites/site-1/
drupal_root/sites/site-2/
drupal_root/sites/site-3/
drupal_root/sites/site-4/
and i want add .htaccess
, for example in drupal_root/sites/site-1/
and another different in drupal_root/sites/site-2/
I tried adding .htaccess
directly on drupal_root/sites/site-1/
but it doesn't work.
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.dev.{site-1}.com/test/?$ [OR]
RewriteCond %{HTTP_HOST} ^dev.{site-1}.com/test/?$ [NC]
RewriteRule ^(.*)$ https://www.dev.{site-1}.com/testredirect [R,L]
</IfModule>