Welcome to WebmasterWorld Guest from 54.145.166.96

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)

5+ Year Member



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 ]

into:

[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 ]

into:

[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)

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



You'll need
[QSA,L]
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.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month