I used the php tag to show some posts from my blog into a php page on the main folder. The blog is located at www.domain.com/wordpress The main folder is www.domain.com The php page is named as index.php If I type in inde2x.php, that page show my blog. It doesn't show a page not found error. How do I set this so that if I type in inde2x.php or any php page that isn't in my folder, it show a page not found?
404 error. probably need to look at ht.access folder. Look for how to set up 404 errors on google. Tim
Create a custom error page and then add the following line of code in .htaccess: ErrorDocument 404 http://www.domain.com/404.php Code (markup):
It's possible that your host has previously setup your .htaccess file to load 404.htm or some other file type. Drop in 404.html in your root directory and try it out.
The ErrorDocument given in the post didn't work. It probably didn't work because of the wordpress. I pay for my own hosting so I manually install my wordpress on my website. What else could I try?
Customizing Your 404 with Apache Create a file called .htaccess in the root directory of the server (the one you refer to as '/') and enter your error handlers in the following format, one per line: ErrorDocument [3-digit code] [action] For example, you can point to a custom 404 page like this: ErrorDocument 404 /errors/custom404.html You can also simply have it display some other text: ErrorDocument 404 "Sorry, this page doesn't exist. Make sure you begin the text with a quote (").
I found a solution to this problem. It was the wordpress preventing the ErrorDocument from working in the htaccess file so I moved the htaccess file containing the wordpress stuff to the folder the wordpress is in. And then I put the ErrorDocument in the empty htaccess in the root folder, and it worked. My error php page even show up in IE when the wrong url is typed. It isn't going to work if it is place in the same htaccess that contain the wordpress stuff so the wordpress stuff have to have it own htaccess in it own folder. At least now the ErrorDocument work.