Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi All,

I've got a live site (paid licence) with pretty URLs and a custom 404 page. It works strangely.

I have tried changing HTACCESS ErrorDocument to the absolute path to the file on the server (/home/myusername/public_html/404.php), to the public error page (https://www.mysite.com/404.php) and to the pretty public URL (https://www.mysite.com/404/). I get similar results with all. I've ensure the cache is refreshed.

If I request a random string of characters with no forward slash terminator:

eg. https://www.mysite.com/erwgwergewrg

I see the correct custom 404 page but the the URL displayed in the browser is:
https://www.mysite.com/home/myusername/ ... gwergewrg/

(thus exposing the server's file structure which isn't ideal, and it doesn't look very nice.)

If I request a random string of characters _with_ a forward slash terminator:

eg. https://www.mysite.com/erwgwergewrg/

It works as I would hope and doesn't redirect - just displays the error 404 page content.

if I request a random non-existent PHP file:

eg. https://www.mysite.com/erwgwergewrg.php

I get a plain text response from the server:

File not found.


How can I make all situations result in no redirection, just the display of the error page content - or at the very least not redirect to a URL which exposes my server's file structure (and looks nicer).

?

TY!
Code: Select all
ErrorDocument 404 /404.php
@tim, the problem was caused by some custom rewrite rules manually added to the generated .htaccess.
3 posts Page 1 of 1