Jump to content

Error 404 pages fail to load due to infinite redirect


desbest
 Share

Recommended Posts

Error 404 File Not Found pages on my website to load due to infinite redirect.

144061105_pageisntredirectingproperly.png.7353fcac150e40dead280e868e3fd8a4.png

I believe it has something to do with this line of .htaccess

ErrorDocument 404 /index.php

Putting the following in site/config.php doesn't help.

$config->http404PageID = 27;
Link to comment
Share on other sites

hi,

id 27 is the default id of http 404 error page thus you don't need to "tell" this to your config file
samething for the index.php thing in the htaccess file

in that same htacces file, you can see an intersting link to a blog post about optimising your 404 error
https://processwire.com/blog/posts/optimizing-404s-in-processwire/

but in your case, the first thing i would check is
- is the 404 page not found page still in the page list
- if yes, do you still use the basic-page template for the 404 page and
- if so, have you used the basic page template for something else and then modified the php code in a way that may generate redirection or anything that the 404 page may not be using (fields or else)
you could try creating an empty template, set it as the 404 page template and try to see if the problem persists (remove the config 404 id line that is not useful if you use the default pw page :))

hope it helps

have a nice day

Link to comment
Share on other sites

  • 3 weeks later...
  • Yes the 404 page appears in the page list and it is published
  • No I don't use basic-page template, I use a template I made called error404. Changing the template back to basic-page doesn't work.
  • No I have not modified any core code in processwire. The only file I modified was site/config.php

Also turning on debug mode doesn't help

Any other ideas?

Link to comment
Share on other sites

Hi,

huh, this is really weird, first thing that i can say for sure, the htaccess line you quote has nothing to do with this, i have many pw websites and the 404 page works fine without touching anything in the htaccess file, even changing its slug (http404) for something a little less geeky and a little more frenchy πŸ™‚ (and quite often with a custom template file too)
the only case i can imagine in the htaccess file would be a multilingual website with multilingual slugs for this page, some containing non ascii characters, if using point 14 in the htaccess file after having changed the default slug, you may need to change it in this section too

except for this really particular case, i can't see where the problem could be without having a close look at your own code, if i were you i would start with
- _init.php, init.php, ready.php files if you use any of those, do you use any regex, hook, custom redirection or else that could cause an issue for pages that don't need any
- header or _main.php (i'm a great fan of markup regions :)), same reasons
etc, actually, any kind of code you've written, php or js, that is supposed to work on every page. if you have any, exclude the 404 page from its execution and see if it changes something

hope you'll find something out...

have a nice day

Link to comment
Share on other sites

I've fixed the problem now. I forgot that I had coded a redirect in one of the template files I used, as I made it years ago so I expected it to only be in one file, not two. I spent 2 hours updating my code.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

Γ—
Γ—
  • Create New...