• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Two Quick Questions (htaccess)

Hi everyone! I have two quick questions that I hope you can help me out with. First off, here is the code I currently have in my htaccess to remove index.php, and it works like a charm:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

1) How can I modify this to allow direct access to another php file in the same directory as index.php? (Let's call it file1.php for example's sake.)

2) If the htaccess is placed in the webroot, are its rules inherited in all sub-directories? The reason I ask is that I have a different website in one of my sub-dir's and the links are not working as they are supposed to...could this be due to the htaccess rules defined in its parent folder?

Thank you and I appreciate your assistance!


[eluser]Randy Casburn[/eluser]

1) I'm fairly certain this will do the trick. I'm no .htaccess expert though...
RewriteEngine on
RewriteCond %{REQUEST_URI} !exactfilenamehere.php$
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

2) Yes, you'll need a different .htaccess file in your other root folder of the other "web site". Set some default security rules or just set RewriteEngine off in that file.


Awesome Randy...it works beautifully. Thank you!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.