我创建了名为error.php的自定义404错误页面,现在我想在用户输入的url.like这个链接中显示error.php内容:http://www.youtube.com/asdfasfsd
这是我的htaccess代码:
ErrorDocument 404 https ://localhost/path/error.php
Run Code Online (Sandbox Code Playgroud)
我想在同一个URL中显示error.php内容而不重定向到error.php页面
如果用户键入了无效的URL(例如:https://localhost/path/nnn.php)
当前结果:重定向到error.php
预期结果:在https://localhost/path/nnn.php中显示error.php内容
我的完整htaccess代码:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule index.html$ index.php [L]
RewriteRule service.html$ service.php [L]
RewriteRule ^([^/]*)\.html$ about.php?pid=$1 [L]
RewriteRule ^cont/([^/]*)\.html$ contact-inner.php?tid=$1 [L]
RewriteRule ^contact/([^/]*)/([^/]*)\.html$ contact-page.php?tid=$1&ona=$2 [L]
RewriteRule ^about/([^/]*)\.html$ about-inner.php?oid=$1 [L]
RewriteRule ^service/([^/]*)/([^/]*)\.html$ service-page.php?oid=$1&ona=$2 [L]
ErrorDocument 404 https://localhost/ezhil/path/public_html/error.php
<Files 403.shtml>
order allow,deny
allow from all
</Files>
deny from 117.202.102.84
deny from 58.68.25.210
deny from 91.200.13.112
deny from 86.128.130.170
deny …Run Code Online (Sandbox Code Playgroud)