Skip to content

Instantly share code, notes, and snippets.

@anhtuank7c
Last active April 6, 2016 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anhtuank7c/6271ca239865b9551fa81ad1d0f646ca to your computer and use it in GitHub Desktop.
Save anhtuank7c/6271ca239865b9551fa81ad1d0f646ca to your computer and use it in GitHub Desktop.
CakePHP: Redirect old domain to new domain using .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^old_domain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.old_domain.com [NC]
RewriteRule ^(.*)$ http://new_domain.net/$1 [L,R=301,NC]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment