Jump to content

weird rewrite issue


schilly

Recommended Posts

so i started making a new site based off the code from another.

 

I'm hung up on this rewrite:

 

RewriteRule ^account/(.*) account/index.php?sec=$1 [L]

 

I test it by going to /account/prefs and printing out the _GET array.

 

The _GET array shows this every time instead of "prefs", no matter the variable:

 

Array ( [sec] => index.php )

 

How index.php is getting set as the sec variable beats me. It doesn't matter what /account/sub_sec_name i use, it always gets set to index.php.

 

This code works fine on my other site so I'm not sure what the deal is.

 

Anyone have any ideas?

 

thx.

Link to comment
Share on other sites

.* will match 0 or more characters, since you are not forcing it to traverse to the end of the URL, I'd guess it's simply picking up 0 characters. Try...

 

RewriteRule ^account/(.*)$ account/index.php?sec=$1 [L]

Link to comment
Share on other sites

ok well i figured it out. i left this piece of code out from htaccess which is from my coworker because of the comment on it:

 

#-- No idea what this does

RewriteCond %{REQUEST_FILENAME} -f [NC,OR]

RewriteCond %{REQUEST_FILENAME} -d [NC]

RewriteRule .* - [L]

 

Can anyone explain what this does?

 

After I added this code back in, everything worked.

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.