Mod_rewrite

Hi all ,

Hopefully someone can help me with this, I have read loads of tutorials on this and just cant get my head around it, I have even tried the on-line mod_rewrite code generators but this gave me a internal server error.

basically I have a form that uses the GET value, I use the results to query the database and then display the results on the same page.

The problem im having is that the url can be different each time based on the input for e.g

http://www.domian.co.uk/events/?page=1&county=aCounty&submit=Search OR
http://www.domian.co.uk/events/?page=1&county=aCounty&eventType=Type&submit=Search OR

I would like it to look like this ideally

http://www.domian.co.uk/events/1/aCounty/Search
http://www.domian.co.uk/events/1/aCounty/Type/Search

If anyone could point me in the right direction that would be brilliant

Thanks for your Time

Ian

Hi,

This is a very extensive subject and i’m not sure i can explain at one go. So at least i’ve give you a general picture so you can understand how it works.

http://www.domian.co.uk/events/1/aCounty/Search

In this case, in your rewrite rule, which is the command(s) in the .htaccess file MUST match the pattern above for the rewriting to happen. When i say pattern, that means you should use regular expression to match it. If you don’t know what that is, you need to read it up.

When there is a match, the rewrite will take place… This means the url above will be transformed to your regular url which is: http://www.domian.co.uk/events/?page=1&county=aCounty&submit=Search

Of course the rewriting happens in the background therefore the url will still maintain as it is. Which is:
http://www.domian.co.uk/events/1/aCounty/Search

I hope i answered your question.

Regards,
developer.dex2908

Hi thanks for taking the time to reply , i still dont really understand what i.need to do next , ill have to keep looking about.

Thanks again

Sponsor our Newsletter | Privacy Policy | Terms of Service