Jump to content

Regex right? Mod Rewrite related


sKunKbad

Recommended Posts

Although this is a mod rewrite, I'm hoping somebody can help me with what I am doing because it involves regex.

 

I've got this mod rewrite rule:

 

^books/(Title|Author|Keyword)/(.+)/([0-9]+).php5 /newbooks.php5?Action=Search&SearchIndex=Books&SearchString=$1&SearchBy=$2&Page=$3

 

and its supposed to turn a URLs functionality like this:

http://www.mysite/books/Title/jeronimo/1.php5

 

into this:

http://www.mysite/newbooks.php5?Action=Search&SearchIndex=Books&SearchString=star+wars&SearchBy=Title&Page=1

 

but its not working. Is this my regex, or something else? I have the regexbuddy, so I was pretty certain it wasn't my regex, but i don't know 100%.

 

The URL parameters come from a form, and the action script takes the url parameters and puts them in the new mod rewrite URL like this:

 

if ($_GET['Action'] == 'Passthru'){
header("Location: http://www.mysite.com/books/{$_GET['SearchBy']}/{$_GET['SearchString']}/{$_GET['Page']}.php5");
}

 

The new URL does show up in the browser, so I don't have a clue what is going on. Do you?

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.