Welcome to WebmasterWorld Guest from 107.20.34.173

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 old domain to new domain

     

wheelie34

2:35 pm on Nov 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all (Jim)

After reading many posts just want to check it is this simple

redirect 301 / http://www.new-domain.co.uk/
redirect 301 /folder/ http://www.new-domain.co.uk/
redirect 301 /folder/page.htm http://www.new-domain.co.uk/folder/


The above htaccess will be placed on the old domains hosting.

Do I need anything else in the htaccess, there are no other url's that I need redirecting just folder names and page names, are the above in the correct order or would the first one / overrule the ones below it, I would, for traffic reasons, like to have the folders redirect properly.

Thanks for looking

g1smd

2:58 pm on Nov 2, 2010 (gmt 0)

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



The first rule will redirect all URL requests arriving at the old site. The other two rules will never get to run.

Place the "more specific" redirects first, and the general "/" redirect last; exactly the reverse order of what you have now.


You'll also need rules for "index.html" requests, and those will redirect to new URL without index filename included.

wheelie34

6:14 pm on Nov 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll also need rules for "index.html" requests, and those will redirect to new URL without index filename included.


I have always run root urls, had the redirect to / for years on the old site, do I still need to worry about that?

g1smd

7:12 pm on Nov 2, 2010 (gmt 0)

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



Yes you do, because if something asks for oldside.com/index.html, your newly installed rules will redirect to newsite.com/index.html and only then will the new site redirect to newsite.com/, and that's two steps.

You need to avoid the redirection chain happening, by redirecting index requests at the old site directly to the new URL on the new site.

wheelie34

4:07 pm on Feb 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi g1smd, ok I now have all old urls in the htaccess file, I just tried to test it but got error 500

the very first line of the new htaccess is

redirect 301 /page.php [new-domain.co.uk...]

then 100s of redirect 301 lines and my last line is

redirect 301 / [new-domain.co.uk...]

Is anything else needed?

This is the top of the original htaccess

ErrorDocument 404 /404.htm
AddHandler server-parsed .html
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
Options +FollowSymLinks
RewriteEngine on
# redirect non-www to www subdomain.
RewriteCond %{HTTP_HOST} ^old-domain\.com [NC]
RewriteRule (.*) [old-domain.com...] [R=301,L]
#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.htm
RewriteRule (.*) [old-domain.com...] [R=301,L]

g1smd

5:36 pm on Feb 22, 2011 (gmt 0)

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



The first RewriteRule rule redirects all requests so the final rule never gets to run.

You must have the more-specific index redirect listed before the less-specific non-www redirect.

Do not mix Redirect and RewriteRule syntax in the same file.

Use RewriteRule for all of your redirects and list them most-specific to least-specific.

Alter redirects within the old site to now point to the new site.

wheelie34

6:09 pm on Feb 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK I knew I shouldnt have posted the old htaccess code, I think you have missunderstood, this is all I have in the NEW htaccess

the very first line of the new htaccess is

redirect 301 /page.php [new-domain.co.uk...]

then 100s of redirect 301 lines and my last line is

redirect 301 / [new-domain.co.uk...]

Is anything else needed?

I get error 500 when trying to run it, the rewites etc are in the old sites current htaccess, not in the new htaccess which is to redirect all traffic

wheelie34

8:55 am on Feb 23, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I really need to get this right, the OLD site already has code in its htaccess file

ErrorDocument 404 /404.htm
AddHandler server-parsed .html
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
Options +FollowSymLinks
RewriteEngine on
# redirect non-www to www subdomain.
RewriteCond %{HTTP_HOST} ^old-domain\.com [NC]
RewriteRule (.*) [old-domain.com...] [R=301,L]
#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.htm
RewriteRule (.*) [old-domain.com...] [R=301,L]

Do I keep all the above in the OLD sites htaccess and add all my redirect 301 rules below it?

redirect 301 /page.php [new-domain.co.uk...]
then 100s of redirect 301 lines and my last line is
redirect 301 / [new-domain.co.uk...]

I have created a new htaccess that only has line afer line of redirect 301 entries. I tried it and got error 500

I'm confused

wheelie34

10:06 am on Feb 23, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Would it be best to JUST use this in the old sites htaccess

redirect 301 / [new-domain.co.uk...]

Then use many lines like this, for each page

redirect 301 /page-name.htm [new-domain.co.uk...]

in the htaccess file of the NEW site

wheelie34

11:36 am on Feb 23, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok progress, one redirect had a space which caused the error so no wit works BUT there are a few redirects that are not doing what they should, here's one

redirect 301 /folder/file.htm [new-domain.co.uk...]

when it gets there the address bar is showing

[new-domain.co.uk...]

Where do I look? old site? new site?

jdMorgan

6:49 pm on Mar 4, 2011 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Already posted above:

> Do not mix Redirect and RewriteRule syntax in the same file.

This is important, as are all the other points.

Jim
 

Featured Threads

Hot Threads This Week

Hot Threads This Month