Hi, We are using apache as web server, Jboss as application. Mod_jk is the connector for them. If the webContext name is wrong, how to redirect to 404 page from apache server. Assume that correct page is: http://mysite.com/myapp/login.jsp If any body requested with wrong context name, we need to show page not found page. Example: http://mysite.com/myappA/login.jsp. Please help me regarding. Thanks Srini
Add the following to your .htaccess file replacing the samples with the actual file names. That will redirect all 404 errors to the page filename.php
Hi, I have ErrorDocument 404 /404.html in the .htaccess page and I have place .htaccess in document root folder. and I have added in httpd.conf, but it is not displaying the 404 page when we give wrong web context name. Could you please help me regarding. Thanks Srini
You aren't on a cPanel server? The .htacess file should be in the main public folder. public_html on cPanel, httpdocs, www on others panels. Place it where the the index page for mysite.com is located.
Thanks Colbyt for the update. It is working fine when request a wrong file from the root directory. http://mysite.com/abc.html is showing the 404.html correctly. But when we request with wrong web context like http://mysite.com/myAppSSS/login.jsp, it shows 404 error page from application server, not the actual configured 404.html page? Could you please help me how to display the 404.html when we requrested with wrong page. Thanks Srini
You may need to use this directive (in your httpd.conf) RewriteBase / Also, try entering the 404 directives, into a .htaccess file (again using the RewriteBase directive) Thanks,