Showing posts with label redirection. Show all posts
Showing posts with label redirection. Show all posts

Sunday, 3 September 2017

Redirect from non-www to www in CakePHP

How to redirect from non-www to www in CakePHP?
Put the following code into .htaccess in main directory
 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]


 mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
Copied URL: https://www.shashidharkumar.com/redirect-non-www-www-cakephp/

Featured Post

हां भइया, जीवन है ये! - मुंशीप्रेमचंद को समर्पित!

शीर्षक: हां भइया, जीवन है ये! हां भइया, जीवन है ये — ना कोई मेले की चकाचौंध, ना छप्पन भोग, बस आधी रोटी, और फटी धोती का संजोग। टूटे खपरैल में...