Help with Apache mod_rewrite?
Posted: Wed Oct 08, 2008 4:06 am
I'm trying to set up a couple of rewrite rules, but I'm struggling to get them both to work. One works fine, but the other fails. Just wondered if anyone with maybe a bit more experience with this could lend a hand.
The URL I want to use is
http://www.domain.tld/page/action.html => http://www.domain.tld/index.php?page=page&action=action
or
http://www.domain.tld/page/action.html?foo=bar&x=y => http://www.domain.tld/index.php?page=pa ... oo=bar&x=y
(with any number of additional query string components)
Here is my .htaccess
Now it routes the first type of URL fine, but fails to route the second type, so I can't seem to get anything off the URL except for the page and action.
Can anyone help out?
Cheers
The URL I want to use is
http://www.domain.tld/page/action.html => http://www.domain.tld/index.php?page=page&action=action
or
http://www.domain.tld/page/action.html?foo=bar&x=y => http://www.domain.tld/index.php?page=pa ... oo=bar&x=y
(with any number of additional query string components)
Here is my .htaccess
Code: Select all
RewriteEngine On
RewriteRule ^([A-Za-z]+)/([A-Za-z]+)\.html\?(.*)$ /index.php?page=$1&action=$2&$3 [L]
RewriteRule ^([A-Za-z]+)/([A-Za-z]+)\.html$ /index.php?page=$1&action=$2
Can anyone help out?
Cheers