The Joomla! Forum ™






Post new topic Reply to topic  [ 86 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Thu Dec 01, 2011 7:27 am 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
Bad code. That's a 302 redirect. SEO suicide.

Additionally, the canonical URL for the root home page should end with a trailing slash.

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Mon Jan 16, 2012 10:07 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Mar 21, 2011 9:39 pm
Posts: 17
Hi,
does anyone know how to pass the wrongful URL on to the custom 404 page? I'd like to show it to the user and ask if maybe he/she made a typo?

Something like
Quote:
Location: http://mydomain.com?wrongfulURL


Top
 Profile  
 
PostPosted: Tue Jan 17, 2012 7:50 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue Jan 17, 2012 7:33 pm
Posts: 1
this great fix Thank you very much to gycsabesz:

Code:
defined( '_JEXEC' ) or die( 'Restricted access' );
header ("Location: http://www.youneeditall.com"); exit();

Change URL or leave:

header ("Location:  /"); exit();  - it will move to root



thank you again gycsabesz.


Top
 Profile  
 
PostPosted: Wed Jan 18, 2012 7:53 am 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
Are you sure you want a 302 or "Temporary" redirect?

That's what the code above produces.

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Fri Jan 20, 2012 11:33 pm 
Joomla! Explorer
Joomla! Explorer

Joined: Tue Feb 23, 2010 8:16 pm
Posts: 294
Location: Lancaster UK
I have not read the entire thread but, from the title of this thread there is a simple answer. It could have issues as Sh404SEF is in play, if somebody else has suggested this and it has been rubbished I apologise.

Andrew Eddie has developed a redirect component that picks up on 404 errors, giving you the ability to redirect them to any URL:

http://extensions.joomla.org/extensions/site-management/error-pages/14676

_________________
Joomla Expert http://www.deanmarshall.co.uk/joomla-expert.html Expert Joomla Development and Support
Music For Schools http://www.musicforschoolsltd.co.uk/ Primary Schools Summer Musicals


Top
 Profile  
 
PostPosted: Tue Mar 06, 2012 3:23 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 04, 2012 12:02 am
Posts: 22
THANK YOU ALL FOR THIS!
This worked great for both 404 errors and 500!!
Code:
<?php
header("Location: http://meltmyscents.com ");
exit;
?>


is there a downside to automatically redirecting to the homepage?

_________________
http://blais-family.com
http://meltmyscents.com


Top
 Profile  
 
PostPosted: Wed Mar 07, 2012 1:05 am 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
The canonical URL for your root page should end with a trailing slash.

Your code generates a 302 redirect. That's SEO suicide. Change it to a 301 redirect.

Mass redirecting URLs that no longer exist to your home page is an extremely bad strategy. You'll soon see your site flagged in Google WebmasterTools error reports as having "soft 404 errors".

Redirect single pages to the individual replacement page when the content is a close match. If the old page has truly "Gone" you should be returning the "410 Gone" HTTP status code for it, not redirecting.

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Wed Mar 07, 2012 6:24 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 04, 2012 12:02 am
Posts: 22
Thank you g1smd. How would I redirect the page to 410 gone? would I have to go through all the errors of 404 or 500 that google shows in webmaster tools and redirect to a 410 gone error page?

_________________
http://blais-family.com
http://meltmyscents.com


Top
 Profile  
 
PostPosted: Wed Mar 07, 2012 9:01 pm 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
Status codes beginning 4xx are never redirects. The status code is returned at the originally requested URL.

If some other status code is returned before the 404 status, you have a big problem on your hands that must be fixed.

Redirects have 3xx status codes.

If you can't return 410 Gone, return 404 Not Found, and make sure the error page has links to relevant content pages so the user is just one click away from finding useful content.


5xx errors often indicate a serious configuration error with the site. You need to find and fix that problem.

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Thu Mar 08, 2012 7:39 pm 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
You really do have a death wish for your site don't you?

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Thu Mar 08, 2012 8:39 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 04, 2012 12:02 am
Posts: 22
G1smd, the 500 errors that Google bots are returning still point to a valid page. I checked the server errors and found no errors with the server. the 500 errors seem to be pointing to old jevents...will it still return a page if it has error 500¿

_________________
http://blais-family.com
http://meltmyscents.com


Top
 Profile  
 
PostPosted: Thu Mar 08, 2012 9:14 pm 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
When the server returns Error 500, the human-readable and bot-readable page says "Error 500 - Internal Server Error. You may wish to notify the web host there is a problem with this site."

No content is shown, just an error message.

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Sat Mar 10, 2012 5:46 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 04, 2012 12:02 am
Posts: 22
G1smd,

Google returns this:

http://meltmyscents.com/index.php?option=com_phocagallery&view=detail&catid=2:convention2011&id=272:scentsy-convention-2011&tmpl=component&Itemid=149
500 error Mar 8, 2012


but clicking on the link takes you to a page. Would there be another reason that google bots are returning a 500 error?

_________________
http://blais-family.com
http://meltmyscents.com


Top
 Profile  
 
PostPosted: Sat Mar 10, 2012 8:51 pm 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
I get "Error 404, component not found".

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Sat Mar 10, 2012 10:58 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 04, 2012 12:02 am
Posts: 22
Thats what it should seeing as its not there anymore...so then my question is why is google returning 500?

_________________
http://blais-family.com
http://meltmyscents.com


Top
 Profile  
 
 Post subject: create 404 errors
PostPosted: Wed May 16, 2012 4:49 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed May 16, 2012 4:33 pm
Posts: 3
Been searching for a solution for a while and my problem is that I want to generate 404 errors from old pages that do not exist. We've replaced our site with a joomla site and many of the old urls are being indexed by google as the primary links and in order to replace those with the newer ones, I need to have them return a 404.

so my question is the opposite of most of these posts - I want 404 errors.

We are using aceSEF as well so a url
url http://mysite.com/badurl will 404 but http://mysite/?bio=1 (or whatever) will redirect to the home page.

I've reinstalled joomla 2.5 from scratch on a dev server (we use turnkey linux) and the fresh install does the same thing.

I've chosen the path to error out so google will re-index the good ones. How do I do that?


Top
 Profile  
 
PostPosted: Thu May 17, 2012 6:28 am 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
This is a case where you should be redirecting requests for unwanted URL "A" which is indexed and ranking and presumably bringing traffic, to URL "B" with the intention that only URL "B" will be indexed in the future. To return 404 error when URL "A" is requested, with no indication that "B" is the place to be, is not such a good idea.

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Thu May 17, 2012 12:17 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed May 16, 2012 4:33 pm
Posts: 3
thanks and you would be correct if the content/page of URL "A" is still on our site, which in this case it is not. Google indexed an obscure page on the original site (we are a music site and the artist from URL A is no longer on our site). So I want to drop that page completely!

any suggestions?


Top
 Profile  
 
PostPosted: Fri May 18, 2012 1:34 pm 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
Please stop recommending that people install a 302 redirect pointing to the home page of their site.

This is SEO suicide.


And again, whenever you refer to the root home page of the site, the URL should end with a trailing slash.

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Fri May 18, 2012 2:22 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed May 16, 2012 4:33 pm
Posts: 3
hey G1,
love the spirited opinions. So in my case, what would you suggest if I want to cause a 404 error from old non-existent urls. it's bad that when you google my site an old non-existent url comes up as the key links.
Quote:
thanks and you would be correct if the content/page of URL "A" is still on our site, which in this case it is not. Google indexed an obscure page on the original site (we are a music site and the artist from URL A is no longer on our site). So I want to drop that page completely!

any suggestions?


cheers. rg


Top
 Profile  
 
PostPosted: Sat May 19, 2012 2:08 am 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
You could add this to your htaccess file ahead of any other RewriteRules:
Code:
RewriteRule ^that-page  -  [G]

and requests for that page will be met with a "410 Gone" status.


Usual regular expressions rules apply, so you can do this too:
Code:
RewriteRule ^(that-page|other-stuff|not-needed|deleted)  -  [G]

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Mon May 28, 2012 10:21 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri May 25, 2012 10:25 am
Posts: 51
is it possible to redirect all 404 errors to the homepage without using sh404 ?

_________________
A Joomla games website http://www.jeuxgratuitflash.com
http://www.jeuxgratuitflash.com/les-jeux-en-3d.html


Top
 Profile  
 
PostPosted: Mon May 28, 2012 10:34 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri May 25, 2012 10:25 am
Posts: 51
i finnaly found a way to do it by adding this code to error.php
$safebase=JURI::base();
$app = JFactory::getApplication();
$app->redirect($safebase, null, null, true, true);

_________________
A Joomla games website http://www.jeuxgratuitflash.com
http://www.jeuxgratuitflash.com/les-jeux-en-3d.html


Top
 Profile  
 
PostPosted: Mon May 28, 2012 11:01 pm 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
Quote:
redirect all 404 errors to the homepage

Mass redirecting multiple URLs to the home page is usually a very bad idea.

Redirects should be used only when the new URL is close in content to the URL it is replacing. If content has "gone" it is much more appropriate to return "HTTP/1.1 410 Gone". Failure to do so will likely see you looking at a "Soft 404 Errors" warning in your Google webmastertools account in short order.

The human readable 410 error page should contain useful information to get the user on their way.

_________________
Online since 1995.


Top
 Profile  
 
PostPosted: Mon Oct 22, 2012 7:24 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Jan 19, 2011 6:07 pm
Posts: 1
letuan wrote:
Hello,

You can do the following

Open up your (default template) system/error.php using your favorite editor like dreamweaver or notepad++ , then after this php code:

1. defined( '_JEXEC' ) or die( 'Restricted access' );
?>
copy and paste this php code.
2. <?php
header("Location: ");
exit;
?>


Thankyou very much! ;)


Top
 Profile  
 
PostPosted: Mon Oct 22, 2012 7:58 pm 
Joomla! Guru
Joomla! Guru

Joined: Mon Feb 21, 2011 4:02 pm
Posts: 951
Location: UK
That code likely produces a 302 redirect and makes the problem much worse than it was before.

_________________
Online since 1995.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 86 posts ]  Go to page Previous  1, 2, 3



Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group