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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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! |
|
|||
|
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] |
|
|||
|
"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 |