问题
I have that in my .htaccess.
ErrorDocument 404 https://my_site.com/404.php
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ view_page.php?id_page=$1 [QSA,L]
When I enter that URL: https://my_site.com/this_file_not_exist.php
I'm redirected on: 404.php
But when I enter that URL: https://my_site.com/that_folder_not_exist/bad_folder/..../this_file_not_exist.php
Instead of being redirected on: 404.php
Chrome show this error: ERR_TOO_MANY_REDIRECTS
How to redirect on 404.php when bad URL is found ?
How to also redirect on 404.php when folder is not https://my_site.com/login/ or not https://my_site.com/ ?
Thanks.
来源:https://stackoverflow.com/questions/60463906/how-to-redirect-on-404-php-when-bad-url-is-found