mod_rewrite redirect without query string parameters

This is a discussion on mod_rewrite redirect without query string parameters within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, I am trying to use mod_rewrite to redirect some old URLs to new ones. I need to redirect a ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2007
roryf
 
Posts: n/a
Default mod_rewrite redirect without query string parameters

Hi,

I am trying to use mod_rewrite to redirect some old URLs to new ones.
I need to redirect a URL like 'services.php?id=2' to simply '/services/
all' with no query string parameters. Using the following adds the ?
id=2 to the end of the URL but I want a fresh redirect without this:
RewriteCond $1 ^services.php(.*)
RewriteRule ^(.*) /services/all [L,R=301]

Can anyone help?

Thanks a lot!

  #2 (permalink)  
Old 02-21-2007
shimmyshack
 
Posts: n/a
Default Re: mod_rewrite redirect without query string parameters

On 21 Feb, 19:48, "roryf" <bad...@googlemail.com> wrote:
> Hi,
>
> I am trying to use mod_rewrite to redirect some old URLs to new ones.
> I need to redirect a URL like 'services.php?id=2' to simply '/services/
> all' with no query string parameters. Using the following adds the ?
> id=2 to the end of the URL but I want a fresh redirect without this:
> RewriteCond $1 ^services.php(.*)
> RewriteRule ^(.*) /services/all [L,R=301]
>
> Can anyone help?
>
> Thanks a lot!


just append ? to the rewrite, that way the QS will be empty
> RewriteCond $1 ^services.php(.*)
> RewriteRule ^(.*) /services/all? [L,R=301]


  #3 (permalink)  
Old 02-21-2007
HansH
 
Posts: n/a
Default Re: mod_rewrite redirect without query string parameters

"shimmyshack" <matt.farey@gmail.com> schreef in bericht
news:1172088414.842308.166170@v33g2000cwv.googlegr oups.com...
> On 21 Feb, 19:48, "roryf" <bad...@googlemail.com> wrote:
>> Hi,
>>
>> I am trying to use mod_rewrite to redirect some old URLs to new ones.
>> I need to redirect a URL like 'services.php?id=2' to simply '/services/
>> all' with no query string parameters. Using the following adds the ?
>> id=2 to the end of the URL but I want a fresh redirect without this:
>> RewriteCond $1 ^services.php(.*)
>> RewriteRule ^(.*) /services/all [L,R=301]
>>

> just append ? to the rewrite, that way the QS will be empty
>> RewriteCond $1 ^services.php(.*)
>> RewriteRule ^() /services/all? [L,R=301]


What does the RewriteCond do what is not handled this way
RewriteRule ^services.php /services/all? [L,R=301]

HansH


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:18 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0