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
https://forums.phpfreaks.com/topic/59300-regex-right-mod-rewrite-related/
Share on other sites

Archived

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

×
×
  • 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.