4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: kanuharis on December 05, 2011, 07:40:50 PM

Title: redirect error 302 instead of 404
Post by: kanuharis on December 05, 2011, 07:40:50 PM
hi,
Recently I've lost all of my 4images gallery because of server crash. After re uploading and setting all things as before, I've got a serious problem. The deleted images which I've re uploaded has new url, so the old urls for same image redirect back to homepage. The problem is my webmaster tools account now showing more than 2000 duplicated title, discriptions etc. when I check old url, it is redirecting with "302 moved temporarily" code, which should be "404 not found". I've searched whole forum but no luck. Is there any way to redirect old images url to any custom error page, or redirect back to index page but with "404 not found". Please some one help on this matter.
Thanks and regards..
haris
Title: Re: redirect error 302 instead of 404
Post by: V@no on December 06, 2011, 01:36:06 AM
What type of "old" URL you are referring to?
Title: Re: redirect error 302 instead of 404
Post by: kanuharis on December 06, 2011, 10:16:29 AM
attaching a screen shot directly from webmaster tools
(http://i41.tinypic.com/15gz3go.jpg)

Those second urls are old and redirecting to homepage with 302
Title: Re: redirect error 302 instead of 404
Post by: kanuharis on December 07, 2011, 02:59:42 PM
Please help me somebody
at-least let me know where from this 302 error produced
regards
Title: Re: redirect error 302 instead of 404
Post by: mawenzi on December 07, 2011, 06:48:27 PM
... your problem is caused by a i.m.o. unnecessary [Mod] Search Engine Friendly URLs or similar ...
Title: Re: redirect error 302 instead of 404
Post by: kanuharis on December 07, 2011, 07:30:01 PM
can you please explain. Should I have to remove SEF urls? that's bad :(
any other option?
Title: Re: redirect error 302 instead of 404
Post by: V@no 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)
{
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";
Title: Re: redirect error 302 instead of 404
Post by: kanuharis on December 08, 2011, 05:54:12 PM
thank you soooooo much :D
Now waiting for recrawl
could somebody make this post resolved
regards