I want to place all my static assets (js, css, etc) in a separate folder "public_html". But of course I still want my url to be: http://www.domain.com instead of http://domain.com/public_html
This can be done with .htaccess I suppose but haven't had a开发者_如何学Cny luck with it.
Also do I configure my base_url in codeigniter to be http://www.domain.com or http://www.domain.com/public_html
Thanks!
public_html is the folder on your server where you put your codeigniter files into. In your config file you set the base_url as be http://www.domain.com.
You can put the assets folder in the public_html folder and the url will still be http://www.domain.com.
Example file structure.
server
- www
- etc
- public_html
- application
- config
- config.php
- system
- assets
- css
- images
- js
Actually, I'm pretty sure it's a better pratice to have your system and application directory out of the public_html folder. Something like this:
- www
- application
- public_html
- css
- images
- js
- index.php
- system
No codeigniter files but the index.php need to be in the public_html folder. You just have to point you index.php to them, adjusting 'system_path' and 'application_folder' in application/config/config.php.
In any event, it's safer for them not to be accessible externally. It's also discussed in the codeigniter wiki: http://codeigniter.com/wiki/Moving_your_app_out_of_DOCROOT/
精彩评论