Jump to content

RewriteRule not working right


mikejv

Recommended Posts

Hi all,

This is a strange one that's really bugging me. I have some very simple HTACCESS code:
 

RewriteEngine On
RewriteRule ^(.*?)/?$ index.php?folder=$1


So, visiting mysite.com/admin should point to mysite.com/index.php?folder=admin

However, when using print_r( $_GET ) on index.php, I get:
 

Array ( [folder] => index.php )


I'm getting index.php returned instead of admin, any ideas?

Thanks!
 

Link to comment
Share on other sites

1 hour ago, mikejv said:

I used RewriteCond to ignore index.php to see if that solved anything,

That could work. If it didn't then there was a problem with it.

1 hour ago, mikejv said:

and admin doesn't exist as a file or directory.

Well yes, but this isn't about admin. This is about everything that the rule tries to run on. Make sure that it only runs on something if it does not exist. This is just A Good Thing To Do, but it will also solve your problem.

Link to comment
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.