So I’ve got a customer who came to me for help with his .htaccess.
He’s got a site with a subfolder that has a .htaccess with custom 404s. All good, right? Right. So, what’s the problem, then? The problem is that his main site also has .htaccess. The two seem to be interfering with each other and generating an infinite loop.
Main site .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /view.php?id=$1 [L,QSA]
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# END SSL config
Subfolder .htaccess:
ErrorDocument 404 https://mypastebin.com/vice/404.php
I also tried with some variations of /404.php, /vice/404.php and full URLs, etc. None of it is working.
I tried with this:
ErrorDocument 404 https://mypastebin.com/vice/404.php
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Obviously, this doesn’t quite work and usually results in:
[Tue Oct 18 07:19:32.109454 2016] [core:error] [pid 18255] [client xxx.xxx.xxx.xx:11271] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
Any idears, folks?