Redirecting Users Based on their Country IP Address

I can’t sleep, so it’s time for a rant about redirecting users based on their country IP address.

Just because I am in a country, does not mean I want to be shown a¬†site in that countries language! Okay, some of you might be thinking this sounds perfectly reasonable, because most people in country will be able to read that language. Well, I am here to let you know you are wrong ūüėČ

So what is the correct solution to choosing which language to show your website visitors?

Answer: Web browser cultural settings!

Yes, your browser tells a web server your preferred language.

Examples of why you should check cultural browser settings and not redirect on IP address:

  • You may be a traveler who doesn’t speak that language.
  • You may be a local person who prefers to use a different language. Some countries even have multiple languages, eg Switzerland as four national languages, 3 official languages at a national level. I’ll leave you to go check Wikipedia if you don’t know what they are.
  • There might be more, but the first one is the most important, because that is often me.

Okay, the poor person in an Internet cafe or a local computer may end up out of luck, but that is why you also need a good solution for letting a person change the language. This also goes for a localized site you have sent them to.

Point in case. The other day I logged into the Origin site (a computer game store/publishing platform). For the life of me, I could not find how to change my language settings. Maybe it was there, but after searching for a few minutes I got fed up and quit. Origin seem to have a bad enough reputation as it is without adding more misery to their users.

So… on the landing page, you need to provide the user some options to get where you want to be.

Country flags are often nice. A flag stands out and is recognizable as a way to change a language. Even some text will do with an option to select a new language, especially if you support only two. At the top of the page is nice, although some sites make you hunt down the bottom of the page. Even an animation on entry might be a nice way to where to find the language options.

Another¬†nicety would allow the user to go back to the site you redirected them from. Sometimes I really did want to go to blah.com and not blah.hm (you can look that domain extension up too, apparently it is barren, uninhabited and volcanic ūüėČ

Last time I wrote a site that required multiple languages, I was using ASP.NET MVC. I even made some notes I just found.

Each HTTP request includes a header field “Accept-Language” and contains languages the user’s browser supports, eg:

Accept-Language: en-us,en;q=0.5

ASP.NET will provide you with a Culture and a UICulture.

Culture will let you know preferred date, number and currency formatting, etc. This could even be used to decide a display currency, although I am not sure if this is the best option right now. I’m mainly ranting about languages right now.

CultureUI should be used to decide which resources to load. So this is where you should be deciding which language to display.

So go forth my minions and change all those websites that have been annoying me over the years. Rage against the IP language redirection!

You can use your IP checking for things like Amazon Affiliates program. For some horrible reason, Amazon make you sign up to each or their different countries and send the appropriate affiliate code and URL.

Best Large Archive Format to Extract Files

So sometimes you just want to extract some files from a large archive. It might be a bit late now, but tar.gz is probably not the best archive format for huge archives and removing specific files. It can take a long time to find the file you want and extract it.

Formats like zip (and 7z?) know where the file is located in the archive and can extract it quickly (compared to tar.gz). In the comments of this article some people talk about the length of time tar.gz can take, eg 4 Gig file, 25 minutes.

According to this StackOverflow article, zip, 7z and dar (in non solid mode), can also extract files more quickly from a remote source. They have a list of files and can archive in segments to allow extraction without requiring the whole archive to be unarchived. tar by itself does no compression and harks back to the days of tape drives (tar is short for tape archive) where this is not really important as they use sequential reads.

An answer here mentions tar can store *nix file attributes. It seems like this is an optional parameter.

--xattrs
this option causes tar to store each file's extended attributes in the archive. This option also enables --acls and--selinux if they haven't been set already, due to the fact that the data for those are stored in special xattrs.

But at some point zip also gained support for *nix file attributes.

A unix zip file attributes answer and here is a python example.

zip can also store MSDOS file attributes.

Mobile Friendly Website – Google Changes Ranking Algorithm

Making your website mobile friendly is about to become even more important! Google has announced an algorithm update that will go live on the 21st of April. Website mobile-friendliness will become a ranking signal and significantly impact search results.

They have also provided a webpage to check if your website is mobile friendly, although it seems pretty basic. You are probably better off checking out the Google PageSpeed Insights page to get a better idea of what Google thinks of your mobile friendly website capabilities. If you have a Google Webmasters account, you can also check your mobile-friendliness report here.

 

Google PageSpeed Insights Comparison – SEO Diary

Google PageSpeed is another good test for the websites in our SEO Diary.

DateSiteBrowserSpeed / 100Server ResponseUser Experience / 100
8 April 2015RationalDevMobile670.66s99
Desktop840.66s

PortableCoffee
Mobile630.42s85
Desktop840.42s
Forum.PortableCoffeeMobile620.67s98
Desktop830.53

Below are the original issues identified on the 8 April 2015. We’ll see how many we can fix.

RationalDev.com

Should Fix:

Eliminate render-blocking JavaScript and CSS in above-the-fold content

Consider Fixing:

  • Prioritize visible content
  • Reduce server response time
  • Leverage browser caching
  • Minify JavaScript
  • Minify HTML

User Experience

Consider Fixing:

  • Size tap targets appropriately

PortableCoffee.com

Should Fix:

Eliminate render-blocking JavaScript and CSS in above-the-fold content

Consider Fixing:

  • Reduce server response time
  • Leverage browser caching

User Experience

Consider Fixing:

  • Size tap targets appropriately

Forum.PortableCoffee.com

Should Fix:

Eliminate render-blocking JavaScript and CSS in above-the-fold content

Consider Fixing:

  • Prioritize visible content

  • Reduce server response time

  • Leverage browser caching

User Experience

Consider Fixing:

  • Size tap targets appropriately

WordPress Relative URL – Why use Absolute URLs?

So you want to know why WordPress uses an absolute URL when creating a link within your own WordPress site? When WordPress stores an absolute URL in the database, it makes it harder to create test or development versions of your site. I normally solve this by making the site name point to the server I want (perhaps another article on this). Another alternative is to run some database scripts to change your site name in the database stored URLs.

Some reasons for WordPress absolute URL usage in favor of relative URLs can be found in an answer for this StackOverflow question quoting a WordPress lead core developer.

  • Performance may be better as there is processing¬†involved to construct¬†a WordPress relative URL.
  • the root URL (ie /) can change depending on your setup of WordPress. Changing relative¬†URLs is more error prone.
  • Internally WordPress requires absolute URLs in certain areas and processing this is considered a potential area to introduce¬†programming bugs.
  • Some plugins do not handle relative URLs correctly.

SEO Guru Yoast is also quite vocal about relative URLs and issues they have caused himself and also for his clients including:

  • Duplicate Content of your test server
    • an accidental link to a test environment version of your site can lead to duplicate content issues by accidentally indexing your test site.
  • Spider Traps
    • a relative link ./oops instead of ../oops, can cause a recursive link like /page/oops/oops/oops/ etc. Best not to annoy Google ūüėČ

Also see our upcoming article about trailing slashes on URLs. https://example.com/test is a different URL to https://example.com/test/