Reputation: 91
I have two differents domains : www.domain1.com that points on folder www/domain1 and www.domain2.com that points on folder www/domain2
I want to share common ressources (php files, images,..) into a third folder www/ressources.
For exemple, the php welcome page is the same for the two domains (just using specific variables that make them different) : In my .htaccess I tried this trick for domain1 :
DirectoryIndex ../ressources/test.php?dir=domain1 (and then test.php would be loading specific var located in www/domain1/var.php)
and for domain2 DirectoryIndex ../ressources/test.php?dir=domain2 (and then test.php would be loading specific var located in www/domain2/var.php)
This is not working (getting a BAD REQUEST 400), I guess because the htaccess is traversing the root directory of the domain.
What would be the solution, since I am using a shared hosting solution (OVH) and can only modify .htaccess files (I don't have access to underlying OS) ?
Upvotes: 1
Views: 100
Reputation: 2075
Since you don't have access to the server or virtual host config, the primary way of using an Alias directive won't work. Depending on your requirements you may be able to use a Redirect or RedirectMatch algorithm, which is available for configuration in a .htaccess file. https://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect
Upvotes: 1