.htaccess redirect root directory and subpages with parameters

Posted by wali on Server Fault See other posts from Server Fault or by wali
Published on 2013-10-29T14:52:37Z Indexed on 2013/10/29 15:58 UTC
Read the original article Hit count: 218

Filed under:
|
|

I am having difficulty trying to redirect a root directory while at the same time redirect pages in a sub directory to a different URL. For example:

http://test.example.com/olddir/sub/page.php?v=one

to

http://test.example.com/new/one

while also redirecting the any request to the root of the olddir folder.

I have tried

RewriteCond %{QUERY_STRING} v=one
RewriteRule ^/olddir/sub/page.php /new/? [R=301] 

and

RedirectMatch /oldir "test.example.com"
RedirectMatch /olddir/sub/page.php?v=one "test.example.com/new/one"

Any help at this point will be extremely appreciated...Thanks!

© Server Fault or respective owner

Related posts about apache2

Related posts about .htaccess