URLs with UTF-8 / Non-ASCII Characters

When determining the URL for a web page, you often want to use keywords that accurately describe the page’s content. Sometimes, these keywords aren’t in English and contain accented characters. One thing you can do is choose one URL to be the canonical URL and create a redirect to that URL from another that contains the ascii-equivalent version of the words, e.g.

Canonical: http://www.somedomain.com/nǐhǎo

Redirects:

  • http://www.somedomain.com/nihao
  • http://www.somedomain.com/你好

Sublime Text 2 Shortcuts

Show PHP function list
  • CTRL+r
Clean up code
  • CTRL+ALT+t : HTMLTidy
  • CTRL+ALT+E : Encode special characters
Tag completion, folding
  • CTRL+. : close tag
  • CTRL+SHIFT+[ : Fold Code
  • CTRL+t : Fold Tag Attributes
  • <tag + TAB = autocompletion, e.g. <a + TAB = <a href=””></a>
  • <tag> + ALT + . = autocompletion, eg. <a> + ALT + . = <a></a>
Find in file(s)
  • CTRL+F : Find in file
  • CTRL+SHIFT+F : Find in files (or right click on folder and click Find in Folder)
  • CTRL+H : Find and replace in file

HOSTS File: Change an External Domain to Point Somewhere Else

If you update your hosts file to point a domain to another location, accessing that domain will take you to your new destination. For example, in Windows, your hosts file is at

C:WindowsSystem32driversetchosts

If you add the following:

127.0.0.1 www.google.com

and then open your browser and go to www.google.com, you will not see Google’s home page but rather your local host index page.  This can be handy when you want to disable one javascript include in a page that you don’t have access to. By pointing the external javascript domain to your local host, a 404 not found will be triggered which will prevent the code from running. Everything else, including other references to external javascript files,  in the page will still continue to execute.