Jump to content

Archived

This topic is now archived and is closed to further replies.

AdRock

How to access folder with mod rewrite

Recommended Posts

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 exist

How do i mod rewrite a rule so it finds the folder [b]admin[/b]?

[code]Options +FollowSymLinks
RewriteEngine on
RewriteBase /
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]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
Which htaccess file do i put that in...the one with the mod rewrite or the htaccess within my admin folder

Also how do I mod rewrite for a page such as [b]change-password.php[/b]  ???

Share this post


Link to post
Share on other sites
You put it in the htaccess file that is in the root of your websites folder you upload your files to.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.