76
Discussion & Troubleshooting / Re: redirect error 302 instead of 404
« on: December 08, 2011, 02:38:56 AM »
It's actually lack of feature in 4images or some might say it is a feature, you decide - any errors it redirects to home page instead of showing an error message.
So here it is, show the error page with 404 header if something went wrong
In details.php find:
if (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id) || !$image_row) {
Insert above:
if (!$image_row)
{
}
In categories.php find:
if (!$cat_id || !isset($cat_cache[$cat_id]) || !check_permission("auth_viewcat", $cat_id)) {
Insert above:
if (!$cat_id || !isset($cat_cache[$cat_id]))
{
}
In lang/<your language>/main.php at the end, above closing ?> insert:
$lang['image_error_404_not_found'] = "Error 404 - image not found";
$lang['cat_error_404_not_found'] = "Error 404 - category not found";
So here it is, show the error page with 404 header if something went wrong
In details.php find:
if (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id) || !$image_row) {
Insert above:
if (!$image_row)
{
header("HTTP/1.0 404 Not Found");
show_error_page($lang['image_error_404_not_found']);
}
In categories.php find:
if (!$cat_id || !isset($cat_cache[$cat_id]) || !check_permission("auth_viewcat", $cat_id)) {
Insert above:
if (!$cat_id || !isset($cat_cache[$cat_id]))
{
header("HTTP/1.0 404 Not Found");
show_error_page($lang['cat_error_404_not_found']);
}
In lang/<your language>/main.php at the end, above closing ?> insert:
$lang['image_error_404_not_found'] = "Error 404 - image not found";
$lang['cat_error_404_not_found'] = "Error 404 - category not found";