0

私はCakePHPアプリケーションを開発しましたが、これを本番サーバーにデプロイしましたが、きれいなURLは機能しません。

これが私のサイトのApachevhostです。

<VirtualHost *:80>
       ServerName site.com
    ServerAdmin support@site.com

    DocumentRoot /home/whitey/sites/site.com/htdocs/app/webroot/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/whitey/sites/site.com/htdocs/app/webroot/>
        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>

    ErrorLog /home/whitey/sites/site.com/logs/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /home/whitey/sites/site.com/logs/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

ご覧のとおり、ドキュメントルートはwebroot私のアプリのディレクトリに設定されています。そのディレクトリ内に、次の.htaccessファイルがあります。

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

このセットアップ全体は、XAMPPを実行しているローカルマシンで完全に機能するため、何が問題なのかわかりません。私が考えることができる唯一のことは、vhostの設定が原因で、書き換えルールが有効になっていないことです。しかし、私はそれを修正する方法を知るのに十分なApache構成ファイルの知識を持っていません。

ありがとう。

4

1 に答える 1

1

気にしないでください、私はばかです。昨夜セットアップしたときに、Apacheのmod_rewriteモジュールを有効にするのを忘れました。修正方法は次のとおりです。

sudo a2enmod rewrite
sudo service apache2 restart
于 2012-08-15T03:33:09.110 に答える