Skip to content

Instantly share code, notes, and snippets.

@topleague
Created November 23, 2017 04:55
Show Gist options
  • Save topleague/0a624f54e840d679eb6d1ac9eacc41c0 to your computer and use it in GitHub Desktop.
Save topleague/0a624f54e840d679eb6d1ac9eacc41c0 to your computer and use it in GitHub Desktop.
Code for .htaccess File (Redirecting an Old Domain to a New Domain)
#Use PHP 5.4
# Use PHP54 as default
AddHandler application/x-httpd-php54 .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/php54/lib
</IfModule>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301,NC]
# BEGIN WPSuperCache
# END WPSuperCache
# 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