htaccess的ErrorDocument的404和传递的URL路径

编程入门 行业动态 更新时间:2024-10-24 14:23:48
本文介绍了htaccess的ErrorDocument的404和传递的URL路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我如何通过404'd URL来利用我404.html页的.htaccess

How can I pass the 404'd URL to my 404.html page using .htaccess

例如,如果我访问一个无效的页: /用户/ 123

For example, if I visit an invalid page: /user/123

RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d ErrorDocument 404 /?404.php?error_path={???} ^ =========================================^

从而产生了404重定向到 /404.php?error_path=/user/123

推荐答案

的ErrorDocument 不是的mod_rewrite的一部分,是无效的。难道这是你想找的?

ErrorDocument is not part of mod_rewrite and that is invalid. Is this what your looking for?

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d Rewriterule ^(.*) /404.php?error_path=$1 [R=301,L]

更多推荐

htaccess的ErrorDocument的404和传递的URL路径

本文发布于:2023-11-01 23:20:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550700.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   ErrorDocument   htaccess   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!