Jump to content

Recommended Posts

Alright so I have successfully set up a Mod Rewrite that gives clean URLS to everything on the normal scope.  This deals with files located in the root directory, but the way I am doing admin pages I am having a bit of a problem getting the rewrite to work right with it.

 

Alright so I call the admin page through http://127.0.0.1/admin/

 

I want this URL to go to http://127.0.0.1/admin.php which will call files from within the directory of /Admin/

 

This is what I have in regards to that.

 

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^admin/$ admin.php

 

From what I understand this should rewrite even if the directory exists, but since I have -Indexes I am receiving a 403 Error ( Access Forbidden ) and if I have +Indexes I get the Admin folder.

 

Is there anything I am missing?

 

This is done on an XAMPP 1.7.7 Setup

Apache 2.2.21 ( Win32 )

PHP 5.3.8

 

Edit: The only thing I can think of is to place a .htaccess file in the directory, but shouldn't the main .htaccess file catch the request even before it gets that far?

 

Edit #2: For my local server I am working in a Sub-Folder so technically it is http://127.0.0.1/Site/admin/ and the rewrite base is /Site.  The .htaccess file is located in the /Site/ sub-folder.  That slipped my mind.  I moved the .htaccess file to the Root Directory but I think I would have to rewrite the rewrite items to make it even rewrite correctly.

Link to comment
https://forums.phpfreaks.com/topic/253434-rewrite-even-if-the-directory-exists/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.