apache2 : how to do that "not found" page is repaced by index.html? - apache

I wish apache2 redirects the user to the default page (index.html, or any page I can make), instead showing him the standard "Not found" page when the url is wrong.
What is please the simplest way to do that ?

Related

Custom 404 error page in cPanel is not working

I've added a custom 404 page in cpanel - Advanced - Error Pages. And a file with the name 404.shtml is in the root of my website now. In the .htaccess I've added: ErrorDocument 404 /404.shtml (ErrorDocument 404 /public_html/404.shtml (direct path) also does not do the trick)
And if I call the file direct by going to https://.example.com/404.shtml it is showing. But when I type a page that is not existing, I still get the default Apache Not Found page.
Any clue what I am missing here?

How to directly redirect to 404 error page when enter the wrong url in prestashop 1.7?

Currently when i enter the wrong url for example https://www.example.com/1234 then it redirect to 302 and then redirect to 404 page.
I need to directly redirect to 404 error page for SEO purpose.
I have also tried with below solution in htaccess.
If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404
Please help me with solution.
Thanks in advance.
try in your backoffice :
Shop parameters -> Traffic & SEO
In block -> Set up URLs
Redirect to the canonical URL : 301 Moved Permantly

The requested URL was not found on this server

I have simple html site. how I can fix the problem 'The requested URL was not found on this server' when user gives wrong URL. for example user type mydomain.com/abc.html and this page is not exist on server, so it will cause an error. how to redirect it on error page to avoid this error.
Create a .htaccess file and add this line.
ErrorDocument 404 /foo.html
This will redirect any 404 error to foo.html

Apache directive returning some static content directly from configuration

I am looking for Apache httpd directive, that would immediately return some plaintext content ("System was not configured yet") or at least immediately generate 500 exception (so I can use ErrorDocument 500 'System was not configured yet').
Is there something I could use, or do I need to use some files on dics for this?
use this document :
The JK Connector is a web server component used to invisibly integrate Tomcat with a web server such as Apache or IIS. Communication between the web server and Tomcat is via the JK protocol (also known as the AJP protocol).
http://tomcat.apache.org/tomcat-4.1-doc/config/jk.html
Hope it can help you!
Edit:
you can also see this link:
http://www.viart.com/activating_friendly_urls.html.html
How to make a redirect to 404 custom page if fURLs are enabled
To make a redirect to a custom 404 page please do the following steps:
Login to your ViArt Shop Admin console.
Navigate to Administration > CMS > Custom Pages and create a 404 custom page
Click 'Update' to save the changes.
Access your site via any FTP client program and open your .htaccess file.
Insert the following string at the very beginning of the file:
ErrorDocument 404 /friendly_url.php
- Save the changes and upload the updated file to the root folder of your shop.
Open the file 'friendly_url.php' (located in the root folder) and find such a code:
$is_friendly_url = false;
header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");
exit;
-Replace this code with the following:
header("HTTP/1.0 200 OK");
header("Status: 200 OK");
set_get_param("page", '404');
include_once('page.php');
return;
where '404' is the name of your custom page as created in your ViArt shop Admin console.
Note: If you do not want to create a custom 404 page in your Admin panel please add the following code to your 'friendly_url.php' file:
$echo_string = implode("",file('http://example.com/404_text.txt'));
echo $echo_string;
exit;
where '404_text.txt' is any empty text file saved in the root folder of your shop.
Save the changes in the 'friendly_url.php' file and upload the updated file to the root folder of your shop.
Open your browser and type something like: http://example.com/404, where example.com equals your actual site URL and 404 is the name of your custom 404 page. If you did everything correctly you will see your 404 custom page.
Created a file for that plus error document setting for all possible URLs:
Alias /katello "/usr/share/katello/public/"
<Location /katello>
DirectoryIndex not_configured.txt
ErrorDocument 404 'Katello was not configured yet, please run katello-configure'
</Location>

How do I display 404 errors instead of 403 errors in godaddy's Apache 1.3?

Apparently Apache 1.3 is used by no one except godaddy by now as I can't seem to find any relevant information for this.
I'd like to use .htaccess files to deny direct access to certain files on my site but without letting attackers know that such a file exists so I'd like to display a 404 "file not found" error instead of a 403 "forbidden" error.
Add following code in .htacess file.
RedirectMatch 404 ".*\/\..*"
it will prohibit access to all files or directories starting with a dot, giving a "404 Not Found" error.
with the help of
Is there a way to force apache to return 404 instead of 403?