homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Rewriting Query String Parameters
Help about rewriting URL parameters

5+ Year Member

Msg#: 3824928 posted 11:16 pm on Jan 12, 2009 (gmt 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.



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

Msg#: 3824928 posted 11:21 pm on Jan 12, 2009 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved