Reputation: 597
According to me client demand, he want to use only http://example.com
urls in his codeinigter. in other words he want to fully ignore www from urls path. please somebody let me know, how i can set these setting in codeigniter?
$config['base_url'] = 'http://example.com';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '';
i set this type url in config.php, but still www urls works.
Upvotes: 1
Views: 157
Reputation: 4414
Try this, in your .htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
It will redirect all www
url requests to non-www
url.
e.g
http://www.yoursite/index.php/hello/world?p=123
to
http://yoursite/index.php/hello/world?p=123
Upvotes: 3