views:

47

answers:

1

I want to redirect these URLs:

http://example.com/search to http://example.com/?page=search

http://example.com/search?q=keyword to http://example.com/?page=search&q=keyword

I am trying to use this in .htaccess but doesn't work:

RewriteRule ^search$ ?page=search [nc]
RewriteRule ^search\?(.*)$ ?page=search&$1 [nc]

What am I doing wrong?

A: 

Assuming you want to direct the request to the index.php file include the file in the rules. E.g.

RewriteRule ^search$ index.php?page=search [L]

Give it a try.

andreas
Hi Andreas, it is working for the "/search" but not when adding parameters. Any ideas for passing the parameters?
XaviEsteve
andreas
Also check out: http://www.modrewrite.com/
andreas
XaviEsteve