AdRock Posted August 26, 2006 Share Posted August 26, 2006 I have a folder named admin and when i type in www.mydomain.com/admin it tries to find a page called admin which obvioulsy doesn't existHow do i mod rewrite a rule so it finds the folder [b]admin[/b]?[code]Options +FollowSymLinksRewriteEngine onRewriteBase /RewriteRule ^([A-Za-z0-9]+)/?$ index.php?page=$1 [L]RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/?$ index.php?page=$1&pagenum=$2 [L][/code] Link to comment https://forums.phpfreaks.com/topic/18732-how-to-access-folder-with-mod-rewrite/ Share on other sites More sharing options...
wildteen88 Posted August 26, 2006 Share Posted August 26, 2006 If its a folder you should have a forward slash after admin so its like this:mysite.com/admin/if you want to use admin to go to the admin folder then use this:[code]RewriteRule ^admin$ admin/[/code] Link to comment https://forums.phpfreaks.com/topic/18732-how-to-access-folder-with-mod-rewrite/#findComment-80802 Share on other sites More sharing options...
AdRock Posted August 26, 2006 Author Share Posted August 26, 2006 How would I get it to direct to index.php in the admin folder Link to comment https://forums.phpfreaks.com/topic/18732-how-to-access-folder-with-mod-rewrite/#findComment-80829 Share on other sites More sharing options...
wildteen88 Posted August 26, 2006 Share Posted August 26, 2006 It should load up index.php automatically. If your server has had index.php added to the DirectoryIndex directive.If it wasnt configured you might be able to add this to the htaccess file:[code]DirectoryIndex index.php[/code] Link to comment https://forums.phpfreaks.com/topic/18732-how-to-access-folder-with-mod-rewrite/#findComment-80871 Share on other sites More sharing options...
AdRock Posted August 27, 2006 Author Share Posted August 27, 2006 Which htaccess file do i put that in...the one with the mod rewrite or the htaccess within my admin folderAlso how do I mod rewrite for a page such as [b]change-password.php[/b] ??? Link to comment https://forums.phpfreaks.com/topic/18732-how-to-access-folder-with-mod-rewrite/#findComment-81352 Share on other sites More sharing options...
wildteen88 Posted August 28, 2006 Share Posted August 28, 2006 You put it in the htaccess file that is in the root of your websites folder you upload your files to. Link to comment https://forums.phpfreaks.com/topic/18732-how-to-access-folder-with-mod-rewrite/#findComment-81517 Share on other sites More sharing options...
AdRock Posted August 28, 2006 Author Share Posted August 28, 2006 I put it in both htaccess files but it doesn't work.When i type in [b]www.mysite.com/admin/[/b] it asks for my username and password from the htaccess file so i know it works but it's not opening index.php. It will if i add index.php at the end but no on its own Link to comment https://forums.phpfreaks.com/topic/18732-how-to-access-folder-with-mod-rewrite/#findComment-81676 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.