ryancramerdesign / ProcessWire

Our repository has moved to https://github.com/processwire – please head there for the latest version.
https://processwire.com
Other
727 stars 199 forks source link

Homepage showing instead of 404 in some cases #754

Closed devsmo closed 8 years ago

devsmo commented 10 years ago

When the URL contains a space, accented character or some other invalid characters Processwire shows the home page instead of the 404 page.

I think this issue is caused by these lines in .htaccess:

ErrorDocument 404 /index.php [...] RewriteCond %{REQUESTURI} "^/~?[-.a-zA-Z0-9/]*$"

I notice that this issue is fixed on processwire.com but not in the default installation of the CMS. Is there a reason for displaying the home page, and what is the best way to fix this?

ryancramerdesign commented 10 years ago

I'm not seeing that issue here. Just getting 404s when trying to access invalid URLs. What version of ProcessWire? I think that we did fix something related to this sometime between PW 2.4 and 2.5, so you may be able to fix it just by upgrading to PW 2.5 if you aren't running already? Though if running PW 2.5, please point me to a URL or two where I can duplicate it. Thanks.

devsmo commented 10 years ago

Indeed it seems to have been fixed in 2.5.

I'm curious, why did you fix it with these additional rules?

RewriteCond %{REQUEST_URI} "[^-_.a-zA-Z0-9/~]"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?it=/http404/ [L,QSA]

Instead of updating the ErrorDocument like so

ErrorDocument 404 /index.php?it=/http404/
isellsoap commented 8 years ago

@devsmo This issue seems to be fixed, thus I close it. If you think the issue isn’t fixed yet or requires additional work to do, please consider reopening it.