Welcome Guest, Not a member yet? Register   Sign In
where CSS and JS directory?
#1

[eluser]umefarooq[/eluser]
Hi
i want to know that where to put images,css,js and upload folder in a project, either in application,system or project root folder where index.php file lies.
#2

[eluser]Thorpe Obazee[/eluser]
This has been answered a lot of times before. :p

Anyway, I put mine in a folder in the root. I embed it as:

<img src="&lt;?php echo base_url()?&gt;media/images/myimage.gif" />
#3

[eluser]dmorin[/eluser]
Most put them in the project root folder with the index.php file. You don't want people accessing anything directly from the application or system folders.
#4

[eluser]umefarooq[/eluser]
hi thanks for the reply let me try this and hope it will work fine. if i found any problem ill ask my question here.
#5

[eluser]Colin Williams[/eluser]
Quote:You don’t want people accessing anything directly from the application or system folders.

I hear this all the time, but I've yet to hear a good argument or explanation of how exactly doing such could compromise the security of your app.

But, to the OP, I'm assuming you have created a Web site before. And when you used CSS and JavaScript files, you simply put them in a publicly accessible location and linked to them. It's no different with CI.
#6

[eluser]GSV Sleeper Service[/eluser]
Quote:I hear this all the time, but I’ve yet to hear a good argument or explanation of how exactly doing such could compromise the security of your app.

in the rare occurrence that something goes wrong and apache starts serving your .php files as text files, a quick visit to yourdomain.com/application/config/database.php would reveal some potentially damaging information.

A similar thing happened to facebook about 6 months or so ago. (apache AddType directive went wrong and php code was exposed)
#7

[eluser]xwero[/eluser]
Security is not the only reason why you shouldn't put css, js and image files in the application and/or system directories. What if you decide to move the directories to a directory that is not publicly accessible?

To get on topic static files should be in directories that are publicly accessible or if you share those files between applications you can create a directory where you store the shared files and symlink the ones you need for the specific application in its publicly accessible directory.




Theme © iAndrew 2016 - Forum software by © MyBB