What would be the best way to redirect codeigniter website to www domain? The only way that comes to my mind is to use htaccess for this but can’t figure out exactly how. This is the rewrite rule I’m using right now to remove index.php from the url. How should I add the redirection to www domain correctly?
RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|uploads|robots\.txt|favicon\.png|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L]
See this URL
.htaccess Redirect non-WWW to WWW preserving URI string
Or try it
Another example
See this URL
Codeigniter redirects for a new domain
Try it
Try adding the following to the .htaccess file in the root directory of your http://www.xyz.com site.