htmanning has asked for the wisdom of the Perl Monks concerning the following question:
I need a way through the .htaccess file to strip everything after the question mark and pass it to something like:www.site.com/article.html?id=1234&site=mysite
So I'm using the following to detect the mobile browsers and pass them to the script, but it doesn't really work. It passes them to the script but includes the entire original URL after the question mark:www.site.com/cgi-bin/article.pl?id=1234&site=mysite
The last line doesn't really work. Any idea if this is doable? I know it's slightly off topic but there are some smart people around here. Thanks.RewriteEngine on RewriteCond %{REQUEST_URI} !^/mobile/.*$ RewriteCond %{HTTP_USER_AGENT} "Windows CE" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Ericsson" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Samsung" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "NetFront" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Palm OS" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Blazer" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Elaine" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "^WAP.*$" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Plucker" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "vodafone" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "iPhone" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "nokia" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "symbian" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Opera Mini" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "BlackBerry" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "j2me" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "midp" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "htc" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "java" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "sony" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "android" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "AvantGo" [NC] RewriteRule (.*) http://www.site.com/cgi-bin/article.pl?$1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Grabbing query string
by CountZero (Bishop) on Jan 31, 2011 at 07:03 UTC | |
|
Re: Grabbing query string
by chrestomanci (Priest) on Jan 31, 2011 at 09:21 UTC | |
by htmanning (Friar) on Jan 31, 2011 at 19:14 UTC |