-2

I want to redirect

whorus.php?lang=en&id=99

into

about.php?lang=en&id=99
  • I want to keep the same query string [QSA]

  • I want to change the page ["whorus" -> "about"]

what should I use? Redirect? RewriteRule

anubhava
  • 761,203
  • 64
  • 569
  • 643
Atara
  • 3,523
  • 6
  • 37
  • 56

2 Answers2

1

If you want an internal rewrite then following will work:

RewriteEngine On
RewriteRule ^whorus\.php$ /about.php [L,NC,QSA]

If you want an external redirect (change the URL in the browser) then following will work with R flag:

RewriteEngine On
RewriteRule ^whorus\.php$ /about.php [L,NC,QSA,R=301]

Reference: Apache mod_rewrite Introduction

anubhava
  • 761,203
  • 64
  • 569
  • 643
  • I tried this, but when I try to browse [http://www.mySite.com/whorus.php?language=_en] is translated into [http://www.mySite.com/home/mySite/public_html/about.php?language=_en] => not found, because of the additional [home/mySite/public_html] what is missing? – Atara Oct 30 '13 at 08:50
  • OK edited, can you try now. – anubhava Oct 30 '13 at 09:00
0

The query string should remain with something like this. This will perform a permanent 301 redirect.

RewriteRule whorus.php http://www.newsite.com/about.php [L,R=301]
LiamB
  • 18,243
  • 19
  • 75
  • 116