Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite help reqd.

is it possible to generate a page name from query string?

         

marcus76

9:41 am on Jun 3, 2009 (gmt 0)

10+ Year Member



Hi,

I do hope someone can help me with this. I'm not sure if this is possible via mod rewrite or whether i'd need to do some additional coding to perform this operation.

I have this url:

http://www.example.com/advanced_search.php?q=keyword1+keyword2

Which creates this:

http://www.example.com/keyword1+keyword2.html

Using this:

RewriteEngine On
RewriteRule ^([^/]*)\.html$ /advanced_search.php?q=$1 [L]

However, i really want to replace the + with a hyphen (-), so the final URL looks like this:

http://www.example.com/keyword1-keyword2.html

I'd really appreciate some ideas on how i may achieve this. I can't see a way to remove the '+' as they are required for the search query, which i'm building the page from the results.

Kind Regards

Marcus

[edited by: dreamcatcher at 5:52 pm (utc) on June 3, 2009]
[edit reason] use example.com. Thanks. [/edit]