404 Catching without htaccess | Sololearn: Learn to code for FREE!

+2

404 Catching without htaccess

Can I catch a 404 without htaccess? Or can u say how wordpress catch 404 without having a htaccess file.

12/3/2017 3:59:37 AM

AA Shakil

2 Answers

New Answer

0

It's possible to do this over your apache virtualhost file.. You have to add the following line to the virtualhostfile: "ErrorDocument 404 /error.php" Here is an example: <VirtualHost *:80> DocumentRoot /var/www/my-site/ ServerName www.my-site.tld ServerAlias my-site.tld DirectoryIndex welcome.html CustomLog /var/log/apache2/my-site.access.log "combined" ErrorLog /var/log/apache2/my-site.error.log ErrorDocument 404 /error.php ErrorDocument 403 /error.php ErrorDocument 500 /error.php </VirtualHost>

0

Wordpress is having always a .htaccess file. So don't know what you need to know?