Drupal 7, trying to use Site.php to redirect localhost requests

我是研究僧i 提交于 2019-12-11 16:14:38

问题


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.



来源:https://stackoverflow.com/questions/7038917/drupal-7-trying-to-use-site-php-to-redirect-localhost-requests

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!