esahp Posted December 10, 2006 Share Posted December 10, 2006 How would I restrict the entire HTACCESS file (or just certain rules *in* it), to the directory it's in?For example: /home/blah/public_html/.htaccess - works in /home/blah/public_html but does not work in /home/blah/public_html/booMy HTACCESS consists of:[code]RewriteEngine onRewriteRule ^id/([^/\.]+)/?$ index.php?id=$1[/code] Link to comment https://forums.phpfreaks.com/topic/30097-htaccess-current-directory/ Share on other sites More sharing options...
wildteen88 Posted December 10, 2006 Share Posted December 10, 2006 If you place an .htaccess file in the public_html folder it will work in that folder aswell as any subfolders within the public_html folder too.Your rewrite rule will work in both directories, however it will differently. For example when u do this:mysite.com/id/123 it will translate to this: mysite.com/index.php?id=123However when you do this same when you go to mysite.com/boo/id/123 it will translate to this:mysite.com/boo/index.php?id=123 In other words if you do mysite.com/ it will use the index.php in the root of the public_html folder whereas mysite.com/boo will use the index.php file in the boo folder and not the index.php in the root of the website (public_html). Link to comment https://forums.phpfreaks.com/topic/30097-htaccess-current-directory/#findComment-138575 Share on other sites More sharing options...
esahp Posted December 11, 2006 Author Share Posted December 11, 2006 Yeah, I know about that. I spent a few days trying to get that right, and so far so good.My question is can I do either of these two things with htaccess:1) Can I make it so certain rules inside the HTACCESS apply to a specificed directory (no more no less)?OR2) Can I make it so the entire HTACCESS applies to a certain directory (no more no less)?* Sorry if that was blunt, trying to make it clear :) Link to comment https://forums.phpfreaks.com/topic/30097-htaccess-current-directory/#findComment-138697 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.