Skip to content

Instantly share code, notes, and snippets.

@huntlyc
Last active December 16, 2015 14:59
Show Gist options
  • Save huntlyc/5452316 to your computer and use it in GitHub Desktop.
Save huntlyc/5452316 to your computer and use it in GitHub Desktop.
Custom redirects with WordPress
#Domain Redirect
<IfModule mod_rewrite.c>
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?huntlywordpress\.co\.uk$ [NC]
RewriteRule ^ http://www.huntlywordpress.com%{REQUEST_URI} [R=301,L]
</IfModule>
#EndDomain Redirect
#BEGIN custom redirects (single page)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RedirectMatch 301 ^/contact\/$ http://www.huntlywordpress.com/contact/
</IfModule>
#END custom redirects
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment