0

アップデート:

サブドメインでテストしました-.htaccessとPHPはありません。を作成し、 と にindex.htmlアクセス/?p=http:/してみました/?p=http://。このエラーが発生しました/?p=http://

Forbidden

You don't have permission to access / on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache Server at test.example.com Port 80

これにより、PHP または mod_rewrite の問題が除外されます。Apache の何が問題になっていますか?

ケース 1 (機能しない): mysite.com?p=http://

ケース 2 (動作): mysite.com?p=http:/

http://クエリ文字列にorhttps://またはがあるとftp://、エンコードしてもエラーになります。index.php(エントリ スクリプト) とtest.php(このエラーをテストするため) があります。クエリ文字列内のURL (経由index.php)にアクセスすると、他のパラメーターがあっても変数は空になります。にアクセスすると、(URL の変更なしで) にリダイレクトされ、エラーが発生します (フレームワークが無効な要求を処理します)。他のものに置き換えると、すべてが正常に機能します-それが何を意味するかを示し、他のすべてのリクエストは入力された状態で行われます.http://$_GETtest.php?p=http://index.phphttp://test.phpindex.php$_GET

このエラーに気付いたのは、新しいホスト (hostdime から hostgator) に移動した後でした。これを他の場所(古いホスト、ローカルサーバー)で再現できませんでした。

ありがとうございました。

私の .htaccess ファイルから、無関係なコードが削除されました。

# Use PHP 5.3
AddType application/x-httpd-php53 .php

# ----------------------------------------------------------------------
# Start rewrite engine
# ----------------------------------------------------------------------

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    # removes www.
    # ------------------------------------------------------------------
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

    # rewrite "domain.com/foo -> domain.com/foo/"
    # ------------------------------------------------------------------
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
    RewriteRule ^(.*)$ /$1/ [R=301,L]

    # Yii specific rewrite
    # ------------------------------------------------------------------
    # if a directory or a file exists, use it directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # otherwise forward it to index.php
    RewriteRule . index.php 
</IfModule>


# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist 
# ------------------------------------------------------------------
Options -MultiViews 



# ----------------------------------------------------------------------
# UTF-8 encoding
# ----------------------------------------------------------------------

# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset utf-8

# Force UTF-8 for a number of file formats
AddCharset utf-8 .html .css .js .xml .json .rss .atom


# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------

<IfModule mod_deflate.c>
...
</IfModule>


<IfModule mod_expires.c>
...
</IfModule>


<IfModule mod_autoindex.c>
    Options -Indexes
</IfModule>


# Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or Git.
<IfModule mod_rewrite.c>
    RewriteCond %{SCRIPT_FILENAME} -d
    RewriteCond %{SCRIPT_FILENAME} -f
    RewriteRule "(^|/)\." - [F]
</IfModule>

# Increase cookie security
<IfModule php5_module>
    php_value session.cookie_httponly true
</IfModule>
4

2 に答える 2

3

どうやらこれはホストの問題です。HostGator に問い合わせたところ、mod_security の問題であるとのことでした。説明がうまくいかない場合は、指定したリンクで apachetail コマンドを実行するように伝えてください。

これらのリンクは少し役立つかもしれません

http://forums.hostgator.com/mod-security-and-403-errors-t71394.html

http://www.codingforums.com/showthread.php?t=233958

http://www.codingforums.com/showthread.php?t=244525

于 2012-06-12T09:04:08.000 に答える