CodeIgniter Forums
force to www - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: force to www (/showthread.php?tid=77297)



force to www - mjamilasfihani - 08-13-2020

Hi there! I want to use www in my domain, because of cloudflare reason, as far I know CodeIgniter is using non www as the default. Can someone help me please? Thanks


RE: force to www - InsiteFX - 08-13-2020

Just edit the .htaccess file in the root where index.php is

Find this in the file:

Code:
    # Rewrite "www.example.com -> example.com"
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

Remark out the 3 lines with a # sign:

Code:
    # Rewrite "www.example.com -> example.com"
    #RewriteCond %{HTTPS} !=on
    #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    #RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]