Drupal 7, trying to use Site.php to redirect local

2019-09-02 06:33发布

问题:

hi I'm trying to get my multisites config working, and am struggeling at the 1st hurdle I want my sites.php to redirect requests to one of my two test sites folders. I can't seem to understand how to use this array?

as I'm using an Xampp install my requests look like this.

  • http://localhost/sitename

where sitename is my website project and would be locally known as

  • c:\xampp\htdocs\sitename

I want to implement a redirector something like

  • c:\xampp\htdocs\sitename\normal...
  • c:\xampp\htdocs\sitename\mobile...

using the sites.php example (shown here)

  • $sites = array(
  • 'devexample.com' => 'example.com',
  • 'localhost.example' => 'example.com',
  • );

I can't see how I can interpret my address. i.e.

  • http://localhost/sitename/mobile
  • http://localhost/mobile/sitename

into the sites.php files i.e.

  • $sites = array(
  • 'localhost.mobile' => 'mobile',
  • 'localhost' => 'normal',
  • );

thanks.. p.s. This is similar to my other recent question, but is different due to being about sites.php not drupal multifolder layout.

回答1:

I believe I've found the answer to this, and its to edit the hosts file on my windows installtion to cause a web address to redirect back to 127.0.0.1 to be picked up by the local web server. then drupal site.php can use the new web name to effect its redirect.

I think it was one of those can't see the wood for the trees issues.