我正在尝试使用Sage主题设置一个简单的WordPress开发环境。我不太熟悉VirtualHosts是如何工作的,但我只是按照我记得的过去设置它的步骤进行。
我为我的项目创建了一个配置文件:
<VirtualHost *:80>
ServerName project1.loc
DocumentRoot "/Library/WebServer/Documents/project1"
ErrorLog "/private/var/log/apache2/project1.loc-error_log"
CustomLog "/private/var/log/apache2/project1.loc-access_log" common
<Directory "/Library/WebServer/Documents/project1">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>在我的vhosts目录中还有几个与此完全类似的配置文件。
在主机中:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 project1.loc
127.0.0.1 project2.loc
127.0.0.1 project3.loc
127.0.0.1 project4.loc
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost我已经更新了Sage主题的manifest.json文件中的devUrl:
"config": {
"devUrl": "http://project1.loc"
}我使用以下命令重启了apache:sudo /usr/sbin/apachectl restart
当我在Sage目录中运行gulp watch时,我得到如下结果:
[16:22:59] Using gulpfile /Library/WebServer/Documents/project1/wp-content/themes/project1/gulpfile.js
[16:22:59] Starting 'watch'...
[16:22:59] Finished 'watch' after 29 ms
[BS] Proxying: http://project1.loc
[BS] Access URLs:
----------------------------------
Local: http://localhost:3000
External: http://##.#.#.##:3001
----------------------------------
UI: http://localhost:3001
UI External: http://##.#.#.##:3001
----------------------------------这看起来很好。问题是,由于某种原因,这会重定向到project3.loc。但是,我可以访问project1.loc/wp-admin或其他任何不是根目录的url。
我是不是忘了什么步骤?
发布于 2016-10-09 05:40:35
我想通了。它被缓存了。清除缓存解决了此问题。愚蠢的错误。
https://stackoverflow.com/questions/39937648
复制相似问题