I used .htaccess to protect my admin area and include index.php file in all folders with redirect script so that no one can list my files inside folder. e.g Images, css etc
If someone want to access http://www.mainDomain/scripts/ it will redirect to http://www.mainDomain/
But If someone want to access http://www.mainDomain/scripts/style.css how i will redirect(to protect our code from being copied)
Whatever you send to the client when returning a webpage (Usually a combination of html / css and possibly JavaScript) Will be visible and edit-able by the client. You can’t protect the transmitted data to prevent people from copying / editying it.
Assuming you need your
style.cssas a stylesheet on (one of) your pages, you can’t block users from viewing it. (That would defeat the purpose of having the stylesheet, since you won’t be using it then.)Technically, it is possible to block external addresses from opening the
.css, while allowing server-side access, but that would also block the file when included in a html page.Not really the answer you’re looking for, I’d wager, but sometimes, you just run into limitations of the software you’re working with.