Welcome to WebmasterWorld Guest from 54.167.82.170

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirecting url with special characters

     

mattiaboero

6:04 pm on Mar 19, 2013 (gmt 0)



Sorry this is my first post here but I'm stuck with a URL that I can not redirect.

The URL is http://www.example.com/wp-content/uploads/2012/07/herzog_002.jpg%3Fw%3D690

I've read some other posts in this forum about theredirect and rewrite rule without finding a solution or understand how to find it.

Any advice?


Best regards, Mattia Boero

lucy24

10:10 pm on Mar 19, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



::detour to character viewer::

Oh, it's an escaped query string. ?w=690 Lowish tablet or highish phone.

There is more than one answer depending on the underlying problem. First question: Where did this URL come from in the first place? Is there just one of it, or is it a random example?

And then you get into the deeper questions. It's a request for an image file that can't have originated from your site, or it wouldn't have the malformed URL. Why do you want to redirect it? Or when you say "redirect" do you mean generically "do something about it"?

mattiaboero

10:29 pm on Mar 19, 2013 (gmt 0)



It's just this URL and I dont know how, why and where it appeared. I have a post with this image attached but with a clean URL without %3Fw%3D690. Google webmaster tools shows me the presence of this error 404 so I want to redirect to the correct URL http://www.example.com/wp-content/uploads/2012/07/herzog_002.jpg but with a simple htaccess redirect 301 /wp-content/uploads/2012/07/herzog_002.jpg%3Fw%3D690 http://www.example.com/wp-content/uploads/2012/07/herzog_002.jpg it does not work.

lucy24

1:35 am on Mar 20, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Shortest answer:
You do not have a problem. GWT reports a 404 when trying to access an URL that does not exist. That's what is supposed to happen. In fact you may get into deeper trouble if you try to redirect all 404s.

Everyone has met this bogus-URL issue. I've currently got a flurry of
"GET /games/LucysDownloads.html">Sultan& HTTP/1.1" 404

Solution: find the 404 in gtw, click the "select all" box and then the "Yeah, yeah, shut up about it already" box. (Because of the specific names involved, I already knew that the URL could not be a typo on my own site. But I checked anyway.)

Longer answer: To redirect, you have to figure out whether that URL is arriving at your htaccess file encoded or disencoded.

Encoded: You could make a rule whose pattern says, in part,
\.(jpg|png|html).+

meaning "There's more stuff after the extension."

Disencoded: Here you'd have a RewriteCond that says in part
{QUERY_STRING} .

(meaning that a query string exists)
and then, again,
\.(jpg|html)

et cetera -- listing any extensions that you actually use that would never have a query.

But you honestly don't need to do either one unless the bad URLs are coming in from links that you want and it's out of your power to get the source to fix the spelling.

It's also not a bad idea to check wmt periodically for any parameters. Do this even if you don't use parameters or if you're certain that all your parameters are under control. Search engines can't tell if the parameter is part of your file's own name, or something attached by a linking site. In my case, I found a clutch of parameters that any idiot could tell
#1 means "open in a new window"
and
#2 cannot possibly affect the content of the page.
Sigh.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month