我想使用apache2 VirtualHosts设置一个主站点和一个子域进行开发。这是我的site.conf虚拟主机文件的样子:
<VirtualHost *:80>
ServerName dev.mysite.com
DocumentRoot /var/www/site/subdomain
<Directory /var/www/site/subdomain >
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog ${APACHE_LOG_DIR}/sub.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName www.mysite.com
ServerAlias mysite.com
DocumentRoot /var/www/site/main
<Directory /var/www/site/main >
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
问题是,每次我访问dev.mysite.com时,我都会得到mysite.com。
主站点没有htaccess,子域的.htaccess如下所示:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
我已经尝试了所有其他可以找到的解决方案(使用文字IP,重新排序,使用端口而不是命名主机)...我现在完全陷入困境。该网站当然是启用的。任何人有任何想法吗?
或者更确切地说,我不知道我必须将Wordpress网站url配置为子域,否则它将重定向到给定的域...
因此,解决方案:打开wp_options
表并编辑site_url以包括该子域。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句