404 Catching without htaccess | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

3rd Dec 2017, 3:59 AM
AA Shakil
AA Shakil - avatar
2 Answers
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>
5th Dec 2017, 6:01 AM
Andy
Andy - avatar
0
Wordpress is having always a .htaccess file. So don't know what you need to know?
21st Jan 2018, 11:58 AM
Andy
Andy - avatar