Skip to content

Instantly share code, notes, and snippets.

@hugodias
Last active August 17, 2018 15:21
Show Gist options
  • Save hugodias/6934857 to your computer and use it in GitHub Desktop.
Save hugodias/6934857 to your computer and use it in GitHub Desktop.
CakePHP First HTACCESS for redirect from non-www to www
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
RewriteCond %{HTTP_HOST} !=localhost [NC]
RewriteCond %{HTTP_HOST} !=127.0.0.1
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment