我在自己旁边。我拥有这些我在GIT管理的3个Drupal 7站点。我不使用默认网站,只使用3个多站点。我只想在浏览器中访问本地版本,但我不能。我从本地代码库复制了以下内容。
去年我花了大约三四天时间试图找到悲伤的根源,但无济于事。我非常感谢专业诊断。
默认网站,未使用。
main/sites/abc.com
main/sites/def.org
main/sites/xyz.com
$sites['localhost.main'] = 'default';
$sites['localhost.abc'] = 'abc.com';
$sites['localhost.def'] = 'def.org';
$sites['localhost.xyz'] = 'xyz.com';
(删除时,不会加载“网站”文件夹) - > /Users/Peanut/Sites/vhosts/localhost.conf:
<VirtualHost *:80>
DocumentRoot /Users/Peanut/Sites
ServerName localhost
</VirtualHost>
(我收到安装表格) - &gt; /Users/Peanut/Sites/vhosts/main.conf:
<VirtualHost *:80>
DocumentRoot /Users/Peanut/Sites/main
ServerName main
</VirtualHost>
- &GT; /Users/Peanut/Sites/vhosts/abc.conf:
<VirtualHost *:80>
DocumentRoot /Users/Peanut/Sites/main
ServerName abc
</VirtualHost>
,这是drupal 7的单独站点安装 - &gt; /Users/Peanut/Sites/vhosts/othersite.conf:
<VirtualHost *:80>
DocumentRoot /Users/Peanut/Sites/othersite
ServerName othersite
</VirtualHost>
drupal root中的RewriteEngine On
RewriteCond %{HTTP_HOST} ^def.org$
RewriteRule ^/?$ "http\:\/\/www\.def\.org\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^xyz\.com$
RewriteRule ^/?$ "http\:\/\/www\.xyz\.com\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^abc\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.abc\.com$
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ "https\:\/\/www\.abc\.com\/$1" [R=301,L]
RewriteCond %{HTTP_HOST} ^abc\.com$
RewriteRule ^(.*)$ "https\:\/\/www\.abc\.com\/$1" [R=301,L]
##
127.0.0.1 localhost
127.0.0.1 main
127.0.0.1 abc
127.0.0.1 def
127.0.0.1 xyz
127.0.0.1 othersite
55.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
# Virtual host files that Peanut created, one for each site.
Include /Users/Peanut/Sites/vhosts/*.conf
包含以下内容,我尝试过这两种方法:
NameVirtualHost *:80
#NameVirtualHost *
答案 0 :(得分:0)
我可能会尝试删除您的MAMP安装,并尝试按照这样的指导安装进行操作 - https://www.youtube.com/watch?v=sEe12h9Lryo
我知道,这不是一个好的答案,但也许它会有所帮助。
答案 1 :(得分:0)
现在我可以使用此网址模式访问本地网站...
http://dev.abc
$sites['dev.defaultsite'] = 'default';
$sites['dev.abc'] = 'abc.com';
$sites['dev.def'] = 'def.org';
$sites['dev.xyz'] = 'xyz.com';
- &GT; /Users/Peanut/Sites/vhosts/defaultsite.conf:
<VirtualHost *:80>
DocumentRoot /Users/Peanut/Sites/main
ServerName dev.defaultsite
</VirtualHost>
- &GT; /Users/Peanut/Sites/vhosts/abc.conf:
<VirtualHost *:80>
DocumentRoot /Users/Peanut/Sites/main
ServerName dev.abc
</VirtualHost>
- &GT; /Users/Peanut/Sites/vhosts/def.conf:
<VirtualHost *:80>
DocumentRoot /Users/Peanut/Sites/main
ServerName dev.def
</VirtualHost>
##
127.0.0.1 localhost
127.0.0.1 dev.defaultsite
127.0.0.1 dev.abc
127.0.0.1 dev.def
127.0.0.1 dev.xyz
127.0.0.1 dev.othersite
55.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
# Virtual host files that Peanut created, one for each site.
Include /Users/Peanut/Sites/vhosts/*.conf
包含以下内容:
NameVirtualHost *:80
#NameVirtualHost *
我不知道它是否有帮助,但我确实将settings.php中的base_url更改为:
$base_url = 'http://dev.abc'; // NO trailing slash!