I want both www and non-www to work ! |
Hello forum , i need your help about my codeigniter site.
I have an iOS application which makes a POST request to my site with www example : http://www.mysite.... The response is 301 moved permanently and i can never get the POST data. If i make the POST request to non-www example : http://mysite... Everything works fine ! So here is my current configuration system/application/config/config.php Code: $config['base_url'] = 'http://mysite.....'; .htaccess Code: RewriteEngine on and my apache virtualhost configuration file sites-available/mysite.com Code: <VirtualHost *:80 > any ideas ?? Thanks !!
Just removed these 2 lines from you htaccess. That part removes "www" from any request.
Code: RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] Also, I would recommend you update your mysite.conf to Code: <VirtualHost *:80 > So it can detect both www and none www without issues.
Note that this can potentially cause duplicate content issues with search engines if you allow both www and non-www. You really should use one or the other, but not both, especially in links or you can have a fall in your search engine rankings.
http://moz.com/learn/seo/canonicalization
Just put a link tag (with rel="canonical") in your document's head to point to the canonical version (with or without the www, whichever you prefer, just be consistent). Then the search engines won't hurt your rankings for letting your users browse from either URL. The same can be done for many other situations in which you may end up with "duplicate content": http://moz.com/blog/canonical-url-tag-th...e-sitemaps
Thanks a lot, for your advices , my mysite.conf was as silentium's but i wrote it wrong without realizing it. I had this part right.
The problem was with the htaccess, i removed the 2 lines you mentioned and it solved the problem. (03-23-2015, 12:39 PM)invader7 Wrote: Thanks a lot, for your advices , my mysite.conf was as silentium's but i wrote it wrong without realizing it. I had this part right. Glad I could help. I would recommend you, as mentioned in above replies, only use either www or none www urls. |
Welcome Guest, Not a member yet? Register Sign In |