[eluser]Daniel Moore[/eluser]
[quote author="Xeoncross" date="1240178729"]Thank you for taking the time to re-document this file. I know that when I was first starting out I needed lots of help in understanding the different ways .htaccess could help with my sites.
Also, regarding hiding the PHP files I think that there is a better way to do it. The goal is to hide anything that contains a ___.php at the end (or whatever ext you use) so something like this might be better.
Code:
# If the file/dir is not real
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Or if they are trying to access a PHP file
# (Hide all PHP files so none can be accessed by HTTP)
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
Of course, I have not tested this method yet, but you get the idea.[/quote]
I have to get busy on some real work today, so I won't be able to test it today after all. I've added it to the above .htaccess with notations, however, that it needs testing. I included it as an "alternate" method of doing this, and have labeled both methods with method numbers and explained that they should be exclusive of one another.
I'd like someone who has time to test and confirm this method of hiding PHP files so that I don't have to include a disclaimer nor have a line that "may not work" in that file. If someone has tested or used this method and can confirm it works, then please respond in this thread and let me know. Thanks.
@simshaun: Getting a better .htaccess added to the CodeIgniter docs with a better explanation of the different things you may have to do on different servers would be awesome. The lack of it is exactly why I'm doing this. It seems that someone asks how to do this several times each week, and that's just the one's who aren't researching and finding the answer already in the forums, as it has been answered more times than I can count. However, none of the answers have been a "this answer will work for everyone, no matter your setup" type of answer, which is what we're trying to finally address.