Skip to content

Instantly share code, notes, and snippets.

@cam-gists
cam-gists / 301.htaccess
Created August 20, 2012 15:45
APACHE: 301 redirect
Redirect 301 /oldpage.html /
@cam-gists
cam-gists / speed.htaccess
Created August 20, 2012 15:44
APACHE : increase Speed
<Directory "/home/website/public_html">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
ExpiresByType text/html "access plus 1 day"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 1 day"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
@cam-gists
cam-gists / rest.htaccess
Created August 20, 2012 15:43
APACHE: REST Kinda
#The URL in the browser would be:
#http://css-tricks.com/index.php/teachers/a/
#The actual page rendered by the server would be:
#http://css-tricks.com/index.php?search=teachers&sort=a
RewriteEngine on
RewriteRule ^index/([^/]+)/([^/]+).php /page.php?search=$1&sort=$2 [NC]
@cam-gists
cam-gists / www.htaccess
Created August 20, 2012 15:41
APACHE: Force WWW
RewriteEngine On
RewriteCond %{HTTP_HOST} ^your-site.com [NC]
RewriteRule ^(.*)$ http://www.your-site.com/$1 [L,R=301]
@cam-gists
cam-gists / force.htaccess
Created August 20, 2012 15:40
APACHE: Force Download
AddType application/octet-stream .csv
AddType application/octet-stream .xls
AddType application/octet-stream .doc
AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .mov
AddType application/octet-stream .pdf
@cam-gists
cam-gists / static.js
Created August 20, 2012 15:38
JQuery: Load Static CDN
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
@cam-gists
cam-gists / jquery_cdn.html
Created August 20, 2012 15:38
JQuery: Load via CDN
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('jquery', '1');
/*google.load("jqueryui", "1");*/
</script>
<script type="text/javascript">
$(function(){
console.log('jquery loaded!');
});//END Doc Ready
@cam-gists
cam-gists / index.html
Created August 20, 2012 15:37
HTML5: Basic Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="robots" content="" />
<meta name="author" content="Christopher A. Moore : chris@camdesigns.net" />
<link REL="SHORTCUT ICON" HREF="imgs/favicon.ico">
@cam-gists
cam-gists / seo.php
Created August 20, 2012 15:35
APACHE: Codeigniter - SEO
### Please read description below : the following .htaccess file isn't enough ###
# 1. Activate URL rewriting
RewriteEngine On
# 2. If the base folder is different from /
#RewriteBase /xyz
# 3.a. Removes the "www" ...
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
@cam-gists
cam-gists / crud.php
Created August 20, 2012 15:33
PHP: Codeigniter - CRUD
<?php
/**
* CRUD
*
*/
class Site_model extends CI_Model{
function get_records()
{