Skip to content

Instantly share code, notes, and snippets.

@ZellSnippets
Created January 17, 2014 02:05
Show Gist options
  • Save ZellSnippets/8467276 to your computer and use it in GitHub Desktop.
Save ZellSnippets/8467276 to your computer and use it in GitHub Desktop.
htaccess: Redirect rules
Redirects.
http://codegarage.com/blog/2011/03/how-to-301-redirect-your-wordpress-blog-to-a-new-url/
# Test 1
RewriteEngine on
RewriteRule ^(.*)$ http://yourcodegarage.com/blog/$1 [R=301,L]
# Test 2
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]
# Test 3 from WPMU https://premium.wpmudev.org/blog/how-to-301-redirect-wordpress-posts-to-a-new-domain/
# BEGIN WordPress
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.oldsite.com RewriteRule (.*)
http://www.newsite.com/$1 [R=301,L]
# END WordPress
# Check with http://www.howto301redirect.com/301-redirect-checker/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment