Categories

Post under category: Code Snippets

Redirect non www to www http:// and https://

I was on the search today to figure out how to redirect all traffic from a non-www address to a www address and also keep the SSL in the redirect using htaccess. The following code will allow this to work. RewriteEngine On RewriteCond %{HTTP_HOST} ^+$ RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} So if you visit mydomain.com it will redirect to www.mydomain.com If you visit https://mydomain.com it will redirect you https://www.mydomain.com If you visit subdomain.mydomain.com it will NOT Read More

MySQL – Using the JOIN Operator Within a SELECT Statement

Many times while working with a MySQL  database you will have data spread over multiple tables.  What happens if you need to access information from multiple tables within one query?  In MySQL a JOIN query is just the statement for the job. Its actually quite simple to do this.  Let's work through a simple example. Suppose you were working with a website that sells flower arrangements.  Lets say you have a table Read More

New Blog Post: MySQL Using the JOIN Operand Within a Query - http://goo.gl/KHUij