Skip to content

Instantly share code, notes, and snippets.

View rosemckeon's full-sized avatar

Rose McKeon rosemckeon

View GitHub Profile
@rosemckeon
rosemckeon / htaccess.md
Created December 16, 2013 12:12
How to 301 with htaccess

How to redirect your site to a new domain name with htaccess

You can use a 301 redirect to notify search engines and browsers that your site has permanently moved to a new location. You'll need to have both domain names pointing to your hosting while everyone takes note of these changes. It will take time for Google to update your listings and for returning visitors to see the change. If they have your site bookmarked, their bookmark will update automatically.

The following can be added to the .htaccess file in the root of your public html files. This will point any page at the old domain to the same location on the new domain.

<IfModule mod_rewrite.c>
RewriteEngine on
@rosemckeon
rosemckeon / wp-domain-update-sql.md
Last active May 6, 2022 14:10
Updating Domain in Wordpress via SQL

How to Update Your Domain in Wordpress via SQL

This is helpful for transferring to a new domain / publishing your site after working locally. It is not the best method to use with wordpress as it can casue problems with some widgets which means they dissapear. But sometimes, needs must...

WordPress stores many options as "serialized data", which contains both the string content of things and their length. So when you modify the URL and the length changes, then the serialized data is no longer correct, and PHP rejects it. More info

The main tables you will need to update for any Wordpress installation are wp_options, wp_posts and wp_post_meta. The SQL below will find any instance of your old domain and replace it with your new domain. Making sure your site works properly and loads all attachments on the new server/domain.

**Don't use this method unless you are already familier with using [phpMy

@rosemckeon
rosemckeon / Gruntfile.js
Created November 13, 2013 01:06
How to compile both Foundation 3 and 4 stylesheets in the same project (with dependencies) using Grunt and SASS.
module.exports = function (grunt) {
grunt.initConfig({
// Setup Compass Tasks
// For more details on options available see
// https://github.com/gruntjs/grunt-contrib-compass/blob/master/README.md
compass: {
// General Options for all Compass Tasks