如何重定向.htaccess中未定义的重写规则

如何重定向.htaccess中未定义的重写规则,.htaccess,.htaccess,以下是我目前在.htaccess文件中编写的内容: RewriteEngine on RewriteRule ^contact contact.php RewriteRule ^browse browse.php RewriteRule ^contact/ contact.php RewriteRule ^privacy privacy-policy.php RewriteRule ^signup register.php RewriteRule ^register register.ph

以下是我目前在
.htaccess
文件中编写的内容:

RewriteEngine on
RewriteRule ^contact contact.php 
RewriteRule ^browse browse.php 
RewriteRule ^contact/ contact.php 
RewriteRule ^privacy privacy-policy.php
RewriteRule ^signup register.php
RewriteRule ^register register.php
因此,当用户请求
.htaccess
文件中未定义的内容时,将导致“404未找到”页面


相反,我希望将
.htaccess
中未明确定义的页面重定向到另一个脚本,并传递原始URL。我不想在这里使用
ErrorDocument
s。我该怎么做?

为什么不使用
ErrorDocument
s?为什么不使用
ErrorDocument
s?在此之后,整个站点停止工作,这是错误->内部服务器错误服务器遇到内部错误或配置错误,无法完成您的请求。请与服务器管理员联系,admin@localhost并告知他们错误发生的时间,以及您可能采取的任何可能导致错误的措施。有关此错误的详细信息,请参阅服务器错误日志。在此之后,整个站点停止工作,这是错误->内部服务器错误。服务器遇到内部错误或配置错误,无法完成您的请求。请与服务器管理员联系,admin@localhost并告知他们错误发生的时间,以及您可能采取的任何可能导致错误的措施。有关此错误的详细信息,请参阅服务器错误日志。
RewriteEngine on

RewriteRule ^contact contact.php 
RewriteRule ^browse browse.php 
# why is contact the only one with a slash at the end?
RewriteRule ^contact/ contact.php 
RewriteRule ^privacy privacy-policy.php
RewriteRule ^signup register.php
RewriteRule ^register register.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /other.php [L]