私は CakePHP を使用している Web サイトに取り組んでいます。このサイトにいくつかの機能を追加し始める必要があるので、ライブ サイトから開発マシン (MAMP サーバーを備えた mac os ライオン) にすべてをプルしました。サイト (localhost/example.com/) を読み込もうとすると、ライブ サイト (www.example.com) に自動的にリダイレクトされます。
ルート htaccess ファイルの内容は次のとおりです。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
最初の 2 つと最初 のをコメントアウトするRewriteCond
と、マシンは 500 内部サーバー エラーをスローし、apache/php ログ出力はありません。 RewriteRule
ライブ サイトに自動的にリダイレクトせずに、この Web サイトをローカルで実行するにはどうすればよいですか?
私が提供できる追加情報はありますか?
編集: ここに私の document_root: があり/Applications/MAMP/htdocs
ます。そうあるべきではない/Applications/MAMP/htdocs/example.com
ですか?編集:ここに/webroot/.htaccess
ファイルがあります:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule img/([0-9]*x[0-9]*)/(.*)/(.*)$ files/image/$2/$1/$3 [QSA,L]
RewriteRule (js|css)/vendors/(.*)$ vendors.php?type=$1&file=$2 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
AddType application/x-javascript .js
AddType text/css .css
<IfModule mod_deflate.c>
# compress content with type html, text, and css
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript text/js
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images/flash
SetEnvIfNoCase Request_URI \
\.(?:swf|flv)$ no-gzip dont-vary
# Don't compress images
# SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# SetEnvIfNoCase Request_URI \/image\.php no-gzip dont-vary
# Also don't compress PDF and Flash-files 17-01-2004 MM
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
<IfModule mod_headers.c>
# properly handle requests coming from behind proxies
Header append Vary User-Agent
</IfModule>
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 10 years"
ExpiresByType text/js "access plus 10 years"
ExpiresByType text/javascript "access plus 10 years"
ExpiresByType application/x-javascript "access plus 10 years"
ExpiresByType application/javascript "access plus 10 years"
ExpiresByType image/png "access plus 10 years"
ExpiresByType image/gif "access plus 10 years"
ExpiresByType image/jpeg "access plus 10 years"
ExpiresByType video/x-flv "access plus 10 years"
</IfModule>
FileETag none
<IfModule mod_headers.c>
# 1 YEAR
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 2 DAYS
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=172800, proxy-revalidate"
</FilesMatch>
# 1 MIN
<FilesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=60, private, proxy-revalidate"
</FilesMatch>
</IfModule>
編集: Apache のデバッグ ロギング レベルを有効にしたので、より多くのログ メッセージを表示できます。エラー500でプロジェクトのルートにアクセスしたときのログの詳細は次のとおりです。
[Fri Jun 01 11:00:35 2012] [debug] mod_deflate.c(615): [client ::1] Zlib: Compressed 0 to 2 : URL /example.com/webroot/index.php
[Fri Jun 01 11:00:35 2012] [debug] mod_headers.c(756): headers: ap_headers_output_filter()
エラー 500 でサイトにアクセスした後の access_log データも含めました。
127.0.0.1 - - [01/Jun/2012:11:03:02 -0400] "GET /example.com/ HTTP/1.1" 500 20 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.53 Safari/536.5"