1

WAMP サーバーを使用しており、htaccess を使用して「404 ページが見つかりません」スタイルを変更する必要があります。どうすればいいですか?

"見つかりません

要求された URL /viewprofile.php は、このサーバーで見つかりませんでした」.これが私の htaccess ファイルです

    RewriteEngine on
RewriteRule (.*)-(.*).htm$ viewprofile.php?id=$1
RewriteRule (.*).htm$ viewprofile.php?id=$2
RewriteRule viewads(.*)\.htm$ viewads.php?id=$1
RewriteRule (.*)&(.*)\.htm$ homeads.php?id=$2
RewriteRule (.*).htm$ profile_city.php?id=$1
RewriteRule (.*).htm$ profile_cast.php?id=$1



RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
4

3 に答える 3

1

カスタムエラー応答に関する公式ドキュメントを読むことができます

つまり、次のディレクティブを使用します。

ErrorDocument 404 /Lame_excuses/not_found.html 

ベース構成ファイルにAllowOverride All (またはFileInfo ) が設定されていることを確認してください。

于 2012-09-24T08:51:45.027 に答える
0

httpd.confファイルには、次のErrorDocumentセクションがあります。

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

その後、次のコードを追加します。

ErrorDocument 404 /error.html

これにより、エラーページがerror.htmlというファイルに設定され、.htaccessファイルを使用するよりも優れています。

于 2012-09-24T09:16:02.527 に答える
0

次のコードを使用します

ErrorDocument 404 /404page.html

ページには404page.html、404 not found で表示したい内容を何でも入れることができます。あなたの場合 " The requested URL /viewprofile.php was not found on this server"

于 2012-09-24T08:52:30.013 に答える