Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Rewriting Query String Parameters

Help about rewriting URL parameters

11:16 pm on Jan 12, 2009 (gmt 0)

New User

5+ Year Member

joined:June 11, 2008
posts: 15
votes: 0

I'm having a little trouble creating a RewriteRule that allows for extra parameters. I currently have the following RewriteRule:

RewriteRule ^ski-region/[^/]*/([0-9]+)$ index.php?option=com_skicow&act=cat&task=showCE&id=$1

which converts queries like:

[skicow.com ]


[skicow.com ]

However, I would like to be able to allow for parameters at the end of the URL as well. For example, I would like the following conversions as well:

[skicow.com ]


[skicow.com ]

I tried modifying the .htaccess file by inserting an additional RewriteRule as follows, but $2 is always blank.

RewriteRule ^ski-region/[^/]*/([0-9]+)?.*$ index.php?option=com_skicow&act=cat&task=showCE&id=$1&$2
RewriteRule ^ski-region/[^/]*/([0-9]+)$ index.php?option=com_skicow&act=cat&task=showCE&id=$1

Any help would be appreciated.

11:21 pm on Jan 12, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
votes: 0

You'll need
to append the original query string back on.

By the way, be clear what a rewrite does. It takes a URL request and translates that into an internal filepath. So, it is right to show a domain name in the example requested URL, but for the filepath example don't specify a domain name - there isn't one, it is just a filepath inside the server. That is, the target of the rewrite is NOT another URL. URLs only exist outside of the server; out on the web. Inside the server there are only filepaths.