I have a website (URL: http://www.fromthepitch.com). There seems to be a problem with it issuing error codes. For some reason instead of 404 error page it displays the home page. http://www.fromthepitch.com/asdsad is meant to show a 404 page but instead displays the home page. Any suggestions on how to solve this problem.
in your .htaccess set this line
ErrorDocument 404 /error_404.html
and you customise your error_404.html page
I have a shared hosting account. The domain for fromthepitch.com was in a sub folder of this domain for retailerwork.com which is the main domain on the hosting account. fromthepitch.com's htaccess was being overwritten by retailerwork.com's htaccess. Vidahost my hosting company helped me solve this in a matter of moments on their support line. I hade to turn the RewriteEngine off before inserting the line of code to point to a custom 404 page. I just did not have the knowledge to understand. Maybe if i put more information it would have been clear. Sorry about that.
Related
I am developing a project in which I want to show my custom error page for 404 error. The codes that I have used are working but not totally. So at first, I am showing the structure for my project then the problems I have.
My site name is www.example.com in which I have 4 files and a folder, files are index.php, about.php, error.php, .htaccess and folder name is admin.
In the admin folder I have lots of pages that I am loading with one single page in index.php. the URLs to access any page I am doing it with www.example.com/admin/index.php?page=login like this, so when page is login it shows me the login page.
Up to this everything is good, now I have used a code in .htaccess
ErrorDocument 404 /error.php
So after using it when I am trying to access a wrong URL such as www.example.com/abt.php it shows me the code written in error.php which is quite natural for my code.
So when I am trying to access again two wrong URLs like www.example.com/adminindex.php?page=login and www.example.com/admin/inx.php?page=login it is not showing me the code written in error.php rather it shows me just a message File Not Found.
I want that these two types of wrong URLs it should show me the code written in error.php.
Interestingly what I want is easily happens in localhost but not on in server.
I cannot understand why it is working perfectly fine in localhost but not on the server.
So how can I do that please help me to complete it?
I don't know that whether it can work for you or not? But you can give it a try i think it can resolve your issue which is quite similar to the previously asked question on stack overflow htaccess 404 page redirect not working for sub directory path
brilliantly answered by #anubhava. I hope it can help you to solve the issue. Also if the above does not help you out then you can also visit this 2 links SOLVED "File not found." instead of custom 404 file with php-fpm enabled & SOLVED "File not found" appears instead of 404.shtml (easy htaccess solution)
In fact there is no good method for that without using mod_rewrite.
The only solution would be to put another .htaccess to your /admin subdirectory (with a valid path for your error.php)
in httpd.conf file (the is in AppServ\Apache24\conf directory)
put this
ErrorDocument 404 /error.php
if not be ok try save the file as html
I have issue regarding URL in Codeigniter on server.
Actually, Site was working before shared hosting server like http://example.com/login
But after change server dedicated and integrate SSL, the site not working inner pages. Like https://example.com/login where got below issue:
Not Found
The requested URL /login was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
But home page open https://example.com It might some issue related rewrite or else. I tried using .htaccess also but nothing changed.
Site page is open using add /index.php in between like https://example.com/index.php/login
Any one have idea or trick to sortout it.
Thanks
This is driving me nuts! I've literally spent 5 hours on a problem I mentioned here. With the permalink structure set to the custom
mysite.com/%postname%/
the homepage mysite.com works but none of the subpages do. I've tried creating a web.config with the contents shown on on post 3 of https://wordpress.org/support/topic/removing-indexphp-in-permalinks-using-iis-8, but the mere presence of a web.config at the root causes 500 Internal server errors everything. I've put an empty web.config there and that causes errors 500 on every page as well. I have Windows Server 2012 and IIS8, by the way.
To recap:
Without a web.config, I can access the homepage like mysite.com, but I get a 404 on any subpages such as mysite.com/mysubpage. Those subpages do surface with mysite.com/index.php/mysubpage, however.
Adding an empty web.config or one with the contents shown on https://wordpress.org/support/topic/removing-indexphp-in-permalinks-using-iis-8 and I've also tried the one on http://codex.wordpress.org/Using_Permalinks#Using_Permalinks_Without_mod_rewrite with no success. 500 on every page.
According to http://www.iis.net/learn/extensions/url-rewrite-module/enabling-pretty-permalinks-in-wordpress, I can't use mod_rewrite in IIS8.
I'm dying here :(
Fixed! Installing URL Rewrite 2 (http://www.iis.net/downloads/microsoft/url-rewrite) was the magic elixer.
I want to simulate this error so I can check the custom HTTP 500 page is displayed, not the default one.
Throw a .htaccess with some weird symbols in your document root and call the page
You can break one of the RewriteRules of WordPress if you already have a .htaccess
Just make sure you know what you broke haha
If you deliberately break some code on the site it should display the 500 page.
Hmm you can't have custom 500 error page on wordpress as far as i know.
But give this a try on your .htaccess and let know ;)
ErrorDocument 500 /500.shtml
I have 3 wordpress sites in my machine(in localhost) named site1, site2, site3. Whenever there is page not found it is being redirected to the site1's 404 error page instead of redirecting to their respective 404 pages. may be I set the apache's default error page somewhere. could anybody help me in this regard.
how to reset it back.
check the .htaccess file in the root of your site, I think in there a line should say something similar with ErrorDocument 404 /errors/404.html
try commenting out that line with a # and refresh