Page 1 of 1

Redirecting broken urls

Posted: Wed Dec 12, 2012 9:41 pm
by Peppers
Hi, Google finds several broken urls on my site when sef is on. For examle these:

http://example.com/component/contact/6?Itemid=73
http://example.com/component/contact/6?Itemid=96
http://example.com/component/contact/6?Itemid=31

Can I and/or how do I make a redirect in my .htaccess file to redirect any and all similar urls to:

http://example.com/component/contact/

Thanks

Re: Redirecting broken urls

Posted: Thu Dec 13, 2012 3:14 pm
by dynamictemplate
if you need simple redirection write this
redirect component/contact/6?Itemid=73 component/contact/

first is what and second is where

Re: Redirecting broken urls

Posted: Thu Dec 13, 2012 3:17 pm
by dynamictemplate
if you need with different vars try this

RewriteCond %{REQUEST_URI} /index.php
RewriteCond %{QUERY_STRING} manufacturers_id=Flash%20template [NC]
RewriteRule ^.*$ /type/flash-templates? [R=301,L]

redirect

/index.php?manufacturers_id=Flash%20template

to

/type/flash-templates

Re: Redirecting broken urls

Posted: Thu Dec 13, 2012 9:15 pm
by Peppers
Thank You dynamictemplate.

That was exactly what I was looking for. It was cute that you didn't make it too easy for me by using my example in your second reply, but I do understand how it would work with my example.

Since posting, I discovered this other post http://forum.joomla.org/viewtopic.php?f ... 4&start=30 That seems to be addressing the root of what is causing my problems. Between your solution and what they suggested, I should be able to solve my problems. I may find out in the next day or two.

Thanks

Re: Redirecting broken urls

Posted: Tue Dec 25, 2012 2:31 pm
by Peppers
Resolved!

With the help of "datatrond" in another post, and Screaming Frog SEO Spider http://www.screamingfrog.co.uk/seo-spider/, I discovered what was generating my broken links. There is a (template?) link to /component/contact in the "written by" text in all of my articles. That little thing in the bar at the top of all my articles that I've never paid much attention to. I didn't even realize there was a link imbedded in it.

I always use an alias for author instead of "administrator". That "written by" link is broken because it needs to be pointed to a contact in my contact list. My alias didn't have a contact. I just needed to create a contact for that alias so that the link had a contact to point to.

I still don't understand why the broken urls were only generated when sef was set to on, but my site is working properly now. I'm so grateful for everybody's help on this.

Re: Redirecting broken urls

Posted: Wed Dec 26, 2012 12:16 pm
by EdoRo
Hello,
Any suggestion on how to redirect website.org/home/article to website.org/article

This is working in my .httacces file
RewriteCond %{HTTP_HOST} ^website\.org$ [OR]
RewriteCond %{HTTP_HOST} ^www\.website\.org$
RewriteRule ^index\.php\/article$ "http\:\/\/website\.org\/article" [R=301,L]

This is not working
RewriteCond %{HTTP_HOST} ^website\.org$ [OR]
RewriteCond %{HTTP_HOST} ^www\.website\.org$
RewriteRule ^home\/article$ "http\:\/\/website\.org\/article" [R=301,L]

Thank you:)

Re: Redirecting broken urls

Posted: Thu Dec 27, 2012 3:20 pm
by lrb
It's worth noting unless you have links going to those pages a redirect is not recommended. Google now prefers 404's if the page doesn't exist and 301's when you are redirecting a page that had juice and you want to retain the juice to the new url. Due to the amount of people abusing 301's it is in most peoples intrest to start using 404's over 301's and only ever use 301's when its designed too.

Re: Redirecting broken urls

Posted: Thu Dec 27, 2012 3:54 pm
by EdoRo
Thank you, I guess this is the case here, because this is a valid link.
Google has found this alternate links, and I want them to point to the same address.
Thank you.

Re: Redirecting broken urls

Posted: Fri Dec 28, 2012 2:11 pm
by benforce
dynamictemplate wrote:if you need with different vars try this

RewriteCond %{REQUEST_URI} /index.php
RewriteCond %{QUERY_STRING} manufacturers_id=Flash%20template [NC]
RewriteRule ^.*$ /type/flash-templates? [R=301,L]

redirect

/index.php?manufacturers_id=Flash%20template

to

/type/flash-templates

thanks a bunch man helped a lot

Re: Redirecting broken urls

Posted: Fri Dec 28, 2012 2:37 pm
by lrb
EdoRo wrote:Thank you, I guess this is the case here, because this is a valid link.
Google has found this alternate links, and I want them to point to the same address.
Thank you.
Alternative Links are fine and so are duplicate pages, its about telling Google what the master pages are, that way they won't even bother indexing the additional pages that are accessible. So all these pages that you are seeing in your index it is because you haven't be using Rel Canonical within your pages, Had you been doing so they would of never made it into Googles indexing.

I strongly recommend you start using Rel Canonical over mass redirects, Simply install a SEO component like SH404SEF or AceSEF and let them handle what the master pages are, then simplely remove all the duplicate pages using Googles webmasters tools. Simples.