Development

    Development (2)

    This category is dedicated to developers. We display articles and code snipets which we encounter and/or write. It is all about sharing knowledge!

    Friday, 20 November 2015 16:30

    CSS media queries breakpoints standard sizes

    Written by

    media queries for common device breakpoints

    The @media query is 1/3 of the recipe for responsive design. It is the key ingredient that, in it's simplest form, allows specified CSS to be applied depending on the device and whether it matches the media query criteria.

    Thursday, 12 November 2015 11:19

    htaccess 301 with folder or file exception

    Written by

    I like to develop my websites in a live environment which saves time when it comes to switching it to the world. It also provides an excellent platform for error checks and live behaviour. In order to be able to develop online and on my servers without having to work on my local host, I create a directory which I name say "dev" and which I exclude from search engine crawling in my robot.text file.

    I however came across a challenge with one of my domain which has a 301 redirect. How could I access my newly created folder since when trying to access it I would be redirected. Here is the exception rule and code which allowed me to overcome the challenge:

    RewriteCond %{REQUEST_URI}!^/my-folder/

    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

     

    The above code needs to be added to your .htaccess file. The code permanently redirects with a 301 redirect all traffic to the site to http://www.newdomain.com, except requests to resources in the  /my-folder directories.  The user are redirected to the equivalent of the page they requested by using the (.*) capture group and then including $1 in the new URL.