Strangely encoded url - encoding

Background:
I have been troubled by the following problem for the last week.
Normally webpages encrypt urls using base64, so that http://stackoverflow.com becomes aHR0cDovL3N0YWNrb3ZlcmZsb3cuY29t and it's used like this:
http://www.mysite.com/redir.php?url=aHR0cDovL3N0YWNrb3ZlcmZsb3cuY29t
Problem:
There are pages that use a different encryption of urls I can't crack. They all start with o5o4m4p4b434s2q43626z3 and I assume that's for http://www. comparing different links of this kind.
The urls are like this: http://www.site.com/z.php?url=o5o4m4p4b434s2q43626z3... and they all redirect to an other site.
Research:
I have googled for different ways to encrypt/decrypt urls and text, and data and nothing.
I also googled for "o5o4m4p4b434s2q43626z3" and I got no results. Am I the only one asking how they encode it? =)
Any ideas? How does "http://www." become "o5o4m4p4b434s2q43626z3" ?
Cheers and good hunting!

It sounds like some type of ID that is generated for that URL. Most likely there is a relationship in some type of database that stores both the URL and the code there. When redir.php is loaded, the string inside the url query string is looked up in the database and the user is redirected.

Related

How to prevent Nationbuilder email from breaking links with query parameters?

We use Nationbuilder for our website and discovered that when Nationbuilder encodes links (for tracking), it will break them if they contain multiple query parameters.
For instance, say we insert the following link in an email in Nationbuilder:
click me
Assuming our Nationbuilder website is hosted at www.website.org, then Nationbuilder will rewrite the link as such:
click me
When one clicks the link above, Nationbuilder processes it and records the click event in their system, but then incorrectly redirects to http://www.example.com?a=1 and discards &b=2.
Most people will immediately identify the problem -- our original url, passed as the "u" query parameter above, was not properly encoded by Nationbuilder. At the very least the ampersand before "b" should have been encoded, if not the equal signs as well, so that our entire original url would be captured in the "u" parameter. The correct link created by Nationbuilder, with the proper encoding, should have been this:
click me
Shockingly, Nationbuilder tech support and their engineers say this behavior is "working as expected". We pointed out that no one would expect a working link to become a broken link, but they refuse to treat is as a bug or at least as a design error.
Does anyone have a suggestion for how we can get around this Nationbuilder "feature" of breaking links with query parameters? We use query parameters extensively in our URLs. We were thinking of shortening every link through bit.ly so they would have no query parameters but that seems like a lot of unnecessary work.
Thanks!
Yeah, simply take your link with a parameter, and encode it, using a tool like this, http://meyerweb.com/eric/tools/dencoder/ so your URLs are not broken by NB's processing.
so
example.com/page?a=1&b=2
becomes
example.com%2Fpage%3Fa%3D1%26b%3D2
If none of the provided solutions work, you could use a URL shortening service such as bit.ly, and link to those shortened URLs from your NB email blast, which will then redirect to your full URLs as provided to the shortening service.

Tumblr share url

I've came across this page https://www.tumblr.com/examples/share/sharing-links-to-articles.html which shows a possible way to customly create a share URL for tumblr.
Simplified version of what they have:
Click to share
http://jsfiddle.net/m5ow6bhs/2/
This will take you to the log in page or straight to the share page if you're already logged in. However, if you change the http%3A%2F%2F part to a simple http:// it will now load to a "Not Found Page". http://jsfiddle.net/m5ow6bhs/3/ What the hell Tumblr?
Do you guys have any idea what's going on or what's the correct code to share something to Tumblr?
Cheers.
As with most share services, the URL should be passed as an encoded string. This supports the OPs comments about http%3A%2F%2F(encoded) and http:// (raw).
Tumblr provides variable transformations in the theme operators to handle encoding, but sadly it doesn't work with custom variables.
One quick solution is to drop the http:// part. Example: http://jsfiddle.net/L9jd8dhz/
I have discovered as of recently that the share URL needs to be updated as such:
https://www.tumblr.com/widgets/share/tool?shareSource=legacy&canonicalUrl=<-urlencode(share_url)->&posttype=link
The &posttype= seems to be a new requirement to make the share work correctly.

Facebook Share problem for Non English Urls

We have an arabic website and we are trying to share a Url on face book. The Url looks like
http://www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75
The problem is that the facebook does not get thumbnails present on the above link.
When we debugged this through fiddler, we found that the url that facebook is trying to access is not the same as given above, this url is like
www.website.com/ar/%c3%98%c2%b4%c3%98%c2%a7%c3%99%e2%80%a1%c3%98%c2%af%c3%99%e2%80%b0-%c3%98%c2%b9%c3%98%c2%b1%c3%99%cb%86%c3%98%c2%b6-%c3%98%c2%a7%c3%99%e2%80%9e%c3%98%c2%a3%c3%98%c2%b2%c3%99%c5%a0%c3%98%c2%a7%c3%98%c2%a1-%c3%98%c2%a7%c3%99%e2%80%9e%c3%98%c2%b9%c3%98%c2%a7%c3%99%e2%80%9e%c3%99%e2%80%a6%c3%99%c5%a0%c3%98%c2%a9-%c3%98%c2%a8%c3%98%c2%b9%c3%99%c5%a0%c3%99%cb%86%c3%99%e2%80%a0-%c3%98%c2%b9%c3%98%c2%b1%c3%98%c2%a8%c3%99%c5%a0%c3%98%c2%a9/%c3%99%e2%80%a6%c3%99%cb%86%c3%98%c2%b6%c3%98%c2%a9/story/75
I need to know what facebook did to the url that it became as shown.
One more thing that i know is that this url is not UTF8 encoded. If the given arabic url is converted to UTF8 then it looks like following and not as above
www.website.com/ar/%D8%B4%D8%A7%D9%87%D8%AF%D9%89-%D8%B9%D8%B1%D9%88%D8%B6-%D8%A7%D9%84%D8%A3%D8%B2%D9%8A%D8%A7%D8%A1-%D8%A7%D9%84%D8%B9%D8%A7%D9%84%D9%85%D9%8A%D8%A9-%D8%A8%D8%B9%D9%8A%D9%88%D9%86-%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9/%D9%85%D9%88%D8%B6%D8%A9/story/75
So i need to know which encoding the face book is using or what facebook is doing to access the following url when we share the url
www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75
http://www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75
That's not a URI (or URL). It's an IRI. Unfortunately a lot of software doesn't support IRI directly (including SO, as you can see from the way it has linked only the first part of the address!).
So if you want the link to work everywhere you'll have to write it up as a plain URI with UTF-8-URL-encoded pathnames, as in the last example (%D8%B4...). Browser will usually present the encoded link in the address bar as a nice IRI regardless of the link in the HTML document being plain URI.
%c3%98%c2%b4... is what you get when you take bytes that are UTF-8 encoded and treat them as if they were ISO-8859-1-encoded (and then UTF-8-URL-encoding them again, giving a broken “double UTF-8”). How are you getting the IRI into Facebook? Either there's an interface you're using that you're sending UTF-8 but which expects ISO-8859-1, or it's just a plain old bug on Facebook's part. Either way, you'll have to use the URI version for now.

Codeigniter form action with slashes instead of normal GETs?

Hey, so this is one of those questions that seems obvious, and I'm probably going to feel stupid, but here goes:
I'm doing a CodeIgniter site with a search. Think of a Google type input, where you'd search for "white huskies." I have a search results page that takes a URI (MySite.com/dogs/white huskies), and takes the third part, and performs the search on that term. I'd like this to be done in the URI, and no by POST so my users can bookmark results.
The problem I'm having is how to get that search button directed to Mysite.com/dogs/WHATEVER IS IN THE INPUT. How do I get the what is in the input part into the anchor href? I know I could do this with javascript, but I've heard it's bad practice to force people to have javascript for things this small.
Thanks for the help!
Read: Form redirect to URL containing query term? - pure HTML or Django
(asked for Django, but answer fits here too)
You could have an intermediate POST page that collects the form inputs and concatenates them into a valid URL which you can then redirect to. I'm not sure if this is good or bad SEO practice however, but I can't see another way of doing this without some Javascript intervention.
Perhaps you could look at doing the intermediate POST page which takes the values are redirects you to /search/dog/white/huskies, but also have a Javascript equivalent that does this on the fly on the form submit and does a window.location refresh to the same /search/dog/white/huskies?
Just my 2 pennies worth ;)
It is possible to have CodeIgniter work with $_GET variables and URI segments securely.
A work around I have used in the past is to have the search term collected using POST, parse the required URL for use with URI segments and then redirect your user to this page.
$url = 'mysite.com/search/' . urlencode($_POST['query']);
redirect($url);
This shouldn't effect SEO but something like the URL of a search result is unlikely to have any effect on SEO anyway. Clean URLs are only really meant to be used for permanent content. If you're going to be displaying the search term on the page, remember to use xss_clean(), seen a few people make this fatal mistake before.

Is there a limit on the size of the variables in a custom URL handler?

I need a way to transfer a bunch of information (1-10kb) from an email in the Mail application to my iPhone app.
I was thinking I could craft a custom URL in the body of the email that, when clicked, would transfer the information through a custom URL handler to my app.
However, it's a lot of data. Can I pass that much data in the custom URL handler? e.g. myapp://load?var1=[lotsofdata]&var2=[lotsofdata]
Or, is there some better way I can transfer info from the Mail app to my app?
I don't know what the maximum length is, but I do know that you can have very long data-urls in Safari, which let you store image or other file data in the url itself. If the limits are similar, then you are in luck.
The usual limit for a GET should not be longer than 2083 characters to be on the safe side.
But also it should be a method to read the email directly from your own app, but I'm not very familiar with this solution.
Instead of a link in the email, you could probably just create a form that posts the information instead of sending a get request to your site; that would get around your length limitation (if there is one)
That last answer assumes you have a site to put the data on. If you're trying to keep things purely in email it would be nice to stick the data in the mail message. You can embed images in an email anyway, so why not?
Doing some research, I came across two blog posts that claim to have created large URLs that have worked, although one is using the data: URL scheme and the other is using mailto: .
Your best bet is to probably just try it out: Create a link using myapp:// with a large amount of data, stick it in an email and see if your app reads the entire thing.