How to redirect 404 Not found page to my homepage URL

Describe the issue or problem
How to redirect the 404 Not Found page to the homepage URL?
Does it possible with small code modification or using .htaccess file?

I have read this page about to make custom 404 page
But it still doesn’t met my requirement.

What application are you using?
OJS 3.3.0-11

Additional information
Below is the screenshot of 404 page when i try to add random character on URL bar.


Hi @dnaite

Let me start saying this is not an PKP issue… it’s related with your webserver configuration and need to be covered by you sysadmins or by the hosting service.

Said that, let’s see if we can help you.

You talk about .htaccess so let’s assume you are using apache2 (for future posts, specify the versions of your stack helps to clarify).

First of all, if you didn’t do it before, you will need to tell apache2 to read .htaccess files.

For this, you need to edit the default virtualhost adding the “AllowOverride All” directive (and restart/reload your apache).

Try to do this and then, add a sample htaccess in a testing folder to be sure apache is reading htaccess.

Once this is done, it’s time for the redirection

If you only want to do a 404 redirection to your ojs’s home, the fastest way is to define the “404 error page” and redirect it to index.php in your OJS root adding this to your default’s virtualhost or htaccess:

ErrorDocument 404 /error/error_404.php

Here you have a brief howto: