We have to remove certain images from website for variety of reasons. However, there might be significant traffic coming to the image we removed and will be seeing the static 404 page without any ads.
To leverage these traffic hitting 404 pages, a adding a php redirect would drive them to website homepage or any other page.
Redirect users from 404 page after 5 seconds
After line 1 of file /app/themes/Peafowl/views/404.php, add below code
Now edit the default messages displayed as follows
Upload new 404.php file to /app/themes/Peafowl/overrides/views
To leverage these traffic hitting 404 pages, a adding a php redirect would drive them to website homepage or any other page.
Redirect users from 404 page after 5 seconds
After line 1 of file /app/themes/Peafowl/views/404.php, add below code
Code:
<?php if(!defined('access') or !access) die('This file cannot be directly accessed.');
header("HTTP/1.1 301 Moved Permanently");
header('Refresh: 5;url=http://yourdomain.com');
?>
Now edit the default messages displayed as follows
Code:
<div class="content-width">
<div class="page-not-found">
<h1><?php _se("Image doesn't exist"); ?></h1>
<p><?php _se('The image you are looking was not found. You will be redirected in 5 seconds.'); ?></p>
<?php if(CHV\getSetting('website_search')) { ?>
Upload new 404.php file to /app/themes/Peafowl/overrides/views
Last edited: