homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Redirecting url with special characters

 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



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

::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"?


 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.


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

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,
meaning "There's more stuff after the extension."

Disencoded: Here you'd have a RewriteCond that says in part
(meaning that a query string exists)
and then, again,
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"
#2 cannot possibly affect the content of the page.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved