Welcome to WebmasterWorld Guest from 54.167.40.25

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 redirect including url parameters

301, redirect

     
10:01 pm on Jul 19, 2012 (gmt 0)

New User

joined:July 19, 2012
posts: 2
votes: 0


Hello

I need to redirect some sub directories of a site by identifying parameters in the URL

I have several urls I need to 301 redirect to a different site permenatly

EXAMPLE

I would like to redirect 301 the following URLs

www.example.com/test/Z_InitLoginPcode.do?country=GB&language=EN
www.example.com/test/Z_InitLoginPcode.do?country=DE&language=DE
www.example.com/test/Z_InitLoginPcode.do?country=FR&language=FR

There's also the following URL that I want to stay where they are.

www.example.com/test/Z_InitLoginPcode.do?country=ES&language=ES
www.example.com/test/Z_InitLoginPcode.do?country=CH&language=DE
www.example.com/test/Z_InitLoginPcode.do?country=CH&language=FR

And I would like the redirect to go to

www.newexample.net

HELP! Please...
6:31 am on July 20, 2012 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12714
votes: 244


Read the last few posts in this Forum. It can't be much more than 24 hours since I last posted the boilerplate on query strings (parameters). That will be your starting point.
12:46 pm on July 20, 2012 (gmt 0)

New User

joined:June 15, 2011
posts: 14
votes: 0


Since you want to leave some pages in the /test/ directory you will have to 301 all pages individually on the .htaccess that you want to redirect:

RewriteRule ^test/page-to-keep$ [newsite.com...] [R=301,L]

If you wanted to just 301 the entire directory and add new pages for the ones you want to keep you could use the following:

Rewriterule ^test/(.*) [newdomain.com...] [R=301,L]
1:15 pm on July 20, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Bill. You added a sticky thread a few months ago asking people to use example.com in this forum so that URL auto-linking would be suppressed. Since that request was posted only three or four people have managed to comply with it.
9:50 pm on July 20, 2012 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12714
votes: 244


But the OP was one of them-- unless Bill was in a hurry and didn't have time for the "thread tidy" boilerplate-- so let's be nice to him ;)

Just noticed that if you are starting a new topic in this forum, the Sticky will also be visible at the bottom of the screen in the "This Forum: Newer" spot.

lc, he will have to look at the query string, because that's the significant variable. A conditionless Rule won't work. (France and Germany come with him; Swizerland stays put. Heh.)
7:30 am on July 21, 2012 (gmt 0)

New User

joined:July 19, 2012
posts: 2
votes: 0


Lucy, you're correct that's exactly what I need to do.