Skip to content

Instantly share code, notes, and snippets.

@laurenclark
Created July 3, 2014 22:02
Show Gist options
  • Save laurenclark/e894b431bd100fd9c17d to your computer and use it in GitHub Desktop.
Save laurenclark/e894b431bd100fd9c17d to your computer and use it in GitHub Desktop.
htaccess example
# REWRITES
# Canonical
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site\.co.uk$ [NC]
RewriteRule ^(.*)$ http://www.site.co.uk/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.php$ http://www.site.co.uk/$1 [R=301,L]
#prettyurls
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
#index to root
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment