仮想ホストを作成しようとしていますが、半分しか機能しません。私は走ることができるindex.phpホームページを読み込んでリンクに移動しようとすると、次のメッセージが表示されます。
Not Found
The requested URL /home was not found on this server.
Apache/2.4.7 (Ubuntu) Server at c2s.dev Port 80
(私は使用しています。yii2フレーム、それが意味するものがあれば)。サブドメインを使用してサイトにアクセスすることもできます(サーバーが見つかりません)。正しい設定は何ですか?私はデフォルトでLinux Mint 17.1を使用します。ランプ設定。これは私のc2s.confです。
<VirtualHost 127.0.1.1:80>
DocumentRoot /var/www/c2c/www
ServerName c2s.dev
ServerAlias *.c2s.dev
</VirtualHost>
/etc/hostsに以下を追加しました。
127.0.1.1 c2s.dev
127.0.1.1 *.c2s.dev
ベストアンサー1
Yiiの公式ウェブサイトでは、Apache用のvhostを設定する方法について説明します。例を見てくださいここ
Apacheのデフォルト設定は次のとおりです。
<Directory "path/to/basic/web">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# ...other settings...
</Directory>
あなたの場合は、次のように見えることがあります。
<VirtualHost *:80>
ServerName c2s.dev
DocumentRoot /var/www/c2c/www
<Directory /var/www/c2c/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
ルートWebフォルダの.htaccessファイルは次のとおりです。オプション+FollowSymLinks IndexIgnore/
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php
</IfModule>