Welcome to WebmasterWorld Guest from 23.22.140.143

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

htaccess rewrite encoded url

     
4:36 pm on Jun 15, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Dec 31, 2007
posts: 198
votes: 0


I am wondering if htaccess can help me with this

Facebook is encoding the slashes and question marks after the query string of any link I add to it. So that
example.com?who/what?when
becomes
example.com?who%2Fwhat%3Fwhen
which returns a not found or error message when clicked in the browser

Is there a way htaccess could be used to convert any "%2F" in a url back to a slash "/"
and any "%3F" in a url back to a question mark "?"

I've only used htaccess for redirects, so... be kind.
Thanks you!
2:00 am on June 16, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Yes, encoding of those characters is required by the HTTP protocol specification. Therefore, FaceBook is "doing it right."

Correct your scripts to generate, require, and handle encoded characters as specified. See urldecode() in PHP.

We webmasters are not free to "use any old character anyplace we like" in hostnames, URL-paths, and the query strings appended to those URLs. See RFC2396 - Uniform Resource Identifiers (URI): Generic Syntax [faqs.org] for more information. Note that the 'rules' for encoding vary, based on the three URL-parts that I identified.

Unfortunately, changing your scripts is the fix.

Jim