(I filed this under the “CMS & Wordpress” category due to involving Drupal but maybe it should be somewhere else?)
Here’s the issue:
I’m trying to route all sub-directory Drupal site request traffic through a single PHP file prior to visitors reaching the respective websites they try to visit. The intention being to have a singular point where I can evaluate traffic better instead of being forced to implement custom approaches in each Drupal installation.
So for example, if I have Drupal installed at “www/mydrupal,” and visitors can access this by going to “http||https://(www.)mydrupal.com,” I want to force all requests for this site to go through something like “www/index.php” so that I can have a chance to evaluate the traffic.
That being said, I use Drupal a lot for many projects and since I only have 1 account with my web host, I have to make use of sub-directories for each Drupal installation I maintain, which is okay until I wish to do something more global like this.
In a bigger example, let’s say I have the following folders in WWW:
- www/foobar1 (Accessed by going to https://www.foobar1.com or just foobar1.com.)
- www/foobar2 (Accessed by going to https://www.foobar2.com or just foobar2.com.)
- www/foobar3 (Accessed by going to https://www.foobar3.com or just foobar3.com.)
- www/mainsite_live (Accessed by going to https://www.mainsite.com or just mainsite.com.)
- www/mainsite_test (Accessed by going to https://test.mainsite.com or just test.mainsite.com.)
Is it possible to create an index.php file at “www/index.php,” and force all requests to be evaluated by this file before being subsequently routed onward to whatever site the visitor was initially requesting? With the URL being respectively rewritten to hide the sub-directory? If so, how?
Unless I’m mistaken, I think this means that I need to basically tell my host to reassign all alias I have to be directed to the 1 index.php file but then how would I route the requests to the respective sub-directory for Drupal to take over after the preceding file has a chance to process the requests?
Any insight into this would be appreciated.