Reputation: 77
I've started using SCSS so in my css folder in my project, I have main.css and main.scss.
Is there any way I can prevent hide main.scss when I put this on my ftp? So it's still there, but not available for direct access?
Thanks!
Upvotes: 1
Views: 9407
Reputation: 4263
The problem with @GhostInTheSecureShell's answer is that this also denies access to the files, so the browser cannot download yourfile.css
any more, which is probably not what you wanted.
To hide files (or directories) from index listings, but still allow access to them, use
IndexIgnore yourfile.css
in your .htaccess
file.
This also works with patterns, so you can hide all css files using
IndexIgnore *.css
Or just name the files that you want to hide with a certain pattern, so, for example
IndexIgnore hide_me_*
will hide all files or directories that start with hide_me_
.
Upvotes: 3
Reputation: 1010
Put this inside a .htaccess in the directory with the file you want to hide. Rename the file appropriately though (instead of yourfile.css).
<files yourfile.css>
deny from all
</files>
Of course you can also do this in your httpd.conf file aswell but the paths will need to be amended.
Upvotes: 8