簡體   English   中英

404錯誤頁面未使用htaccess重定向到自定義頁面

[英]404 error page not redirected to custom page using htaccess

我的htaccess規則無法將404錯誤重定向到自定義頁面。 我把下面的代碼:

<IfModule security2_module>
    ErrorDocument 404 https://example.com/404.php
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteRule index\.html$   index.php [L]
</IfModule>

而且我都使用了-ErrorDocument 404 https://example.com/404.phpErrorDocument 404 /404.php

請讓我知道是否有人可以解決

ErrorDocument 404 http://jobguide.australianenglishcenter.com/404/

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ <YourRelativePathToPHPFile>/404.php [L]

在這里,ErrorDocument將所有404重定向到特定的URL

重寫規則將該URL映射到您實際的404.php腳本。 如果需要,可以使RewriteCond正則表達式更通用,但是我認為您必須顯式定義要覆蓋的所有ErrorDocument代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM