Welcome to WebmasterWorld Guest from 54.205.106.138

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 Redirect help - Trying to redirect a few pages to specific destinations

     
12:15 am on Jul 17, 2013 (gmt 0)

New User

joined:July 17, 2013
posts:1
votes: 0


Basically I am trying to redirect a few pages from an old site to specific urls at a new site.

All other URLs on that old site should be redirected to a specific subdirectory on the new site.

This is how I'm trying to do it, but everything is being sent to http://www.example.com/everything-else-points-here/


RewriteRule ^/index.php/exception1(.*)$ http://www.example.com/destination1 [R=301,L]
RewriteRule ^/index.php/exception2(.*)$ http://www.example.com/destination2 [R=301,L]
RewriteRule ^/index.php/exception3(.*)$ http://www.example.com/destination3 [R=301,L]

RewriteRule ^(.*)$ http://www.example.com/everything-else-points-here/ [R=301,L]



Any help would be appreciated because I seem to have hit a wall at this point. Thanks!

Edit: Nevermind, I didn't escape the . in index.php... sigh
3:18 am on July 17, 2013 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
posts:13444
votes: 390


But the unescaped . is just for insurance. In this context it would only make a difference if you're asking for a file named indexzphp/blahblah and getting redirected against your will.

The leading directory slash, otoh, would be a big problem if you're doing this in htaccess or any <directory> section.
4:29 am on July 17, 2013 (gmt 0)

Administrator

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

joined:Aug 10, 2004
posts:10684
votes: 33


welcome to WebmasterWorld, kmac31!


you should also avoid redirecting a large number of urls to a single url as it's rarely a good experience for the visitor and google is likely to treat this as a soft 404 or might even penalize you for using techniques that manipulate pagerank.
12:57 pm on July 17, 2013 (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


Redirecting (.*) to a single URL means that requests for robots.txt, images, css, javascript and other such files are also redirected.

Change the "greedy, promiscuous and ambiguous" .* pattern to something that more closely matches requests for only pages.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members