我有两个具有这种结构的Yiiframework应用程序:
.framework
.site
.site2
但是,如果我尝试打开网站:www.mysite.com/site2我收到404错误的Yii(例外.CHttpException.404)说他没有找到控制器名为:site2
我已经在我的apache上添加了site2的虚拟主机:
<Virtualhost *:80>
ServerName www.mysite.com/site2
ServerAlias www.mysite.com/site2
ServerAdmin www@localhost
DocumentRoot "/home/server/public_html/site2/"
<Directory "/home/server/public_html/site2/">
Order allow,deny
Allow from All
AllowOverride All
</Directory>
</VirtualHost>
我的.htaccess,它位于&#34;网站文件夹&#34; (我重定向到https://):
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*) https://%{HTTP_HOST}/$1
我想要,当我打开网站时:www.mysite.com/site2转到我的子目录/ site2而不是/ site。我做错了什么?
答案 0 :(得分:0)
网站2不是网站,而是网址www.mysite.com/site2
中的子目录ServerName值不正确。您将拥有其他站点名称或子域名
<Virtualhost *:80>
ServerName site2.mysite.com
ServerAdmin www@localhost
DocumentRoot "/home/server/public_html/site2/"
<Directory "/home/server/public_html/site2/">
Order allow,deny
Allow from All
AllowOverride All
</Directory>
</VirtualHost>
或
<Virtualhost *:80>
ServerName www.site2.com
ServerAdmin www@localhost
DocumentRoot "/home/server/public_html/site2/"
<Directory "/home/server/public_html/site2/">
Order allow,deny
Allow from All
AllowOverride All
</Directory>
</VirtualHost>