I use lessCSS. And problem I have is that if in CodeIgniter I set base URL as http://www.mysite.com, and in my browser I go to mysite.com less doesnt render.
And the other way around…
Console gives me this:
XMLHttpRequest cannot load xxxx Origin http://mysite.lt is not allowed by Access-Control-Allow-Origin.
less-1.2.1.min.js:8Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101
Add this to your .htaccess file (assuming you are using Apache):
That will always add www. even if the user doesn’t type it. That should solve your issue.
To do this and remove index.php from urls I use this block of code for my EE installs (which uses CI)
First block is your standard EE based rewrite to remove index.php from all your URLS. The second block of code is a nice addition that keeps urls, where index.php is added anyway by the user, from resolving and giving you duplicate urls with search engines (thus hurting SEO). Instead it properly forwards to the correct URL if it exists, or returns a 404 where appropriate. And of course the final block of code adds (or can remove) www.