Welcome to WebmasterWorld Guest from 54.145.144.101

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)



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 Jul 17, 2013 (gmt 0)

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



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 Jul 17, 2013 (gmt 0)

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



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 Jul 17, 2013 (gmt 0)

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



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month