Forum Moderators: phranque

Message Too Old, No Replies

wildcard .htaccess

error in my URL /<span>

         

valeria olaves

7:59 pm on Jul 25, 2010 (gmt 0)

10+ Year Member



Hello webmasters ;-)

After more than 1 hour searching and trying I give up.
Certainly one of you know how to solve this problem.

Due a stupid error in my programm some tags went in my URL's, and I got over bad 600 URL's index by google, which ofcourse now all give a 404 error.
I'd like to have it clean, also in my google webmastertools.

What happened?
Google indexed the bad URL's.
They all look like this:
www.domain.com/</span> </div></td>
or
www.domain.com/someletters</span> </div></td>
or
www.domain.com/someletters and spaces</span> </div></td>

ALL the bad URL's contain the tag </span>

How can I redirect it 301 with .htaccess ?

Thanks for your help !

Valeria

jdMorgan

8:18 pm on Jul 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What have you tried so far?

For each of the 'bad' URLs you showed, what does the 'good' one look like?

Jim

valeria olaves

11:21 pm on Jul 25, 2010 (gmt 0)

10+ Year Member



Hi Jim,

I tried various combinations in my .htaccess.
I've deleted them so I cannot see anymore which combinations I tried :-(

The last one I've still here and worked
RewriteEngine on
RewriteRule (.*)</span>(.*) /
but it does not give a 301 redirect.
The 301 I want, so that the googlebot doesn't keep trying for all that wrong 404 URL's .
I know that sometimes after months still those 404 error URL's I tried to have been indexed, so to www.domain.com

Thanks in advance,
Valeria

For the good one, I just need a 301 redirect to my index

jdMorgan

11:47 pm on Jul 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Important:
> For each of the 'bad' URLs you showed, what does the 'good' one look like?

I have no idea *where* you might want to redirect these bad requests to...

Jim

valeria olaves

2:36 am on Jul 26, 2010 (gmt 0)

10+ Year Member



Hi Jim,

I need a 301 redirect to my index www.domain.com for all those URL's which contain the word </span>

Thanks for your help,
Valeria

jdMorgan

3:38 pm on Jul 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, so I will assume that all of these malformed requests were intended to go to the home page and that "someletters" are *not* a URL-path -- that is, they do not represent a 'page' or an object request, but are just junk.

The rule in that case would be:

RewriteRule ^[^<]*</span> http://www.example.com/ [R=301,L]

If there are no other RewriteRules in your .htaccess file, then you will need to "set up" mod_rewrite by preceding that rule with either the second of the following two lines, or with both. You will have to test this to find out:

Options +FollowSymLinks -Indexes -MultiViews
RewriteRngine on

Jim

valeria olaves

3:57 pm on Jul 26, 2010 (gmt 0)

10+ Year Member



Top Jim,

Works excellent, problem solved and gives a excellent 301 redirect on the bad URL's

Thank you very much ! ;-)

Valeria