Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

Permanent 301 Redirect


  • This topic is locked This topic is locked
320 replies to this topic

#91 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 6,775 posts
  • Location:Blackpool UK

Posted 16 January 2005 - 02:13 PM

you are looking at DNS. 301 are set on the server not DNS. but the DNS sounds correct.
The exact how depends on your server technology

#92 sweepthelegnate

sweepthelegnate

    HR 6

  • Active Members
  • PipPipPipPipPipPip
  • 903 posts
  • Location:Dallas, Texas

Posted 16 January 2005 - 02:28 PM

sorry, guess my skull is just thicker than most. I think I got it working now...


nathan

#93 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 16 January 2005 - 02:34 PM

Yep, you're doing more of an alias when working with the DNS Nathan. It'll get people to the right content, but it won't change the url in their browser address bar. To the viewer it'll look like they're still on the non-preferred domain.

If it's the site in your profile, or another site on the same server, it looks like you're running on a *nix server. If that's the case, the following should do it as long as your host allows you to use .htaccess files:
  • Change the DNS back to the way it was before.
  • In any simple text editor (Notepad, etc ... not Word) open a new file and put the following line in it
    CODE
    Redirect 301 / http://www.preferreddomain.com/
  • Save that as a file named .htaccess
  • Upload it to the root level of your non-preferred domain.
Now when you call up any page from your non-preferred domain you should be automatically forwarded to the same page on your preferred domain.

#94 sweepthelegnate

sweepthelegnate

    HR 6

  • Active Members
  • PipPipPipPipPipPip
  • 903 posts
  • Location:Dallas, Texas

Posted 16 January 2005 - 02:40 PM

thanks randy...

I did it like this because for some reason the regular redirects were giving me a limit exceeded message.

CODE
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domainone\.com
RewriteRule ^(.*)$ http://www.domaintwo.com/$1 [R=permanent,L]

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domainone\.com
RewriteRule ^(.*)$ http://www.domaintwo.com/$1 [R=permanent,L]

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domaintwo\.com
RewriteRule ^(.*)$ http://www.domaintwo.com/$1 [R=permanent,L]


don't know if this is the best way.

but it seems to be working.

nathan

#95 qwerty

qwerty

    HR 10

  • Moderator
  • 8,604 posts
  • Location:Somerville, MA

Posted 16 January 2005 - 05:37 PM

While we're on the subject of 301s, what's the best way to redirect domain.com/dir/index.htm to domain.com/dir/ ? I thought I had it figured out a few months ago, but when I tried it, the site wouldn't even load.

#96 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 16 January 2005 - 09:23 PM

hmm... That's a tricky on Bob. Because whether someone typed in just the /dir/ or /dir/index.htm the redirect is going to fire off. Effectively creating an endless loop. Even a standard RedirectMatch would freak out over that one, unless you changed the default file name for that one directory.

Lemme think on it for a moment to see if I get any inspiration. lol.gif

#97 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 17 January 2005 - 05:02 PM

Well Bob, I still don't have any inspiration.

Everything I've thought of using .htaccess is going to cause a loop of one sort or another since /dir/ and /dir/index.htm is actually loading the same page.

I can tell you how to do it in PHP by detecting the $_SERVER['SCRIPT_NAME'] variable and then doing a header redirect if index.php appears in the url address. But having Apache do the redirect is considerably trickier.

Anybody else have any thoughts? I feel like I'm missing something.

#98 qwerty

qwerty

    HR 10

  • Moderator
  • 8,604 posts
  • Location:Somerville, MA

Posted 17 January 2005 - 05:12 PM

Don't hurt your head over this biggrin.gif It's a pretty minor problem. A few sites link to this one with domain.com/index.htm, and one of those just happens to send us more traffic than any other source, including search engines, so I thought it might give us a little boost if I could redirect it. And yes, I've tried contacting them to ask them to change it.

Ah well...

#99 Jeff

Jeff

    HR 1

  • Members
  • Pip
  • 3 posts
  • Location:Toronto, Ontario

Posted 03 February 2005 - 05:09 PM

Hi,

Are .htaccess and PHP 301 redirects treated the same by search engines?

Thanks.

#100 Jill

Jill

    Recovering SEO

  • Admin
  • 32,913 posts

Posted 03 February 2005 - 07:24 PM

As long as the page serves up a 301 response, then it doesn't matter how they achieve it.

#101 magicboxgifts

magicboxgifts

    HR 4

  • Active Members
  • PipPipPipPip
  • 117 posts
  • Location:Leicester UK

Posted 08 February 2005 - 06:25 AM

Hi guys

have got access to the .htaccess file with my host but just wondering do I need to add anything

We have changed all our pages to .php from .html to utilise our database info etc.

The main links showing are all to our index page without any suffix (ie www.mydomain.com) so no problem there but I was wondering do i need to ad the 301 to the rest of the pages that have been indexed or should I wait for the purge?

We are on apache servers uploading in ASCII

Thanks guys and keep up the great work.

Edited by magicboxgifts, 08 February 2005 - 06:46 AM.


#102 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 08 February 2005 - 11:52 AM

I would recommend it for two reasons. Partly in case people have an interior page bookmarked or someone is linking to an interior page; and partly to help the search engines get everything switched over quicker.

If your file names remained constant except for the extension change, the easiest way to do that is:
CODE
RedirectMatch 301 (.*)\.html$ http://www.yourdomain.com$1.php


What that does is take any request for <anyfilename>.html and automatically redirects to <anyfilename>.php

#103 BobetteKyle

BobetteKyle

    HR 6

  • Active Members
  • PipPipPipPipPipPip
  • 889 posts
  • Location:Near St. Louis, Missouri

Posted 08 February 2005 - 12:18 PM

Would the same thing work for .shtml also (replacing "php" with "shtml" in Randy's code)? I'm thinking about switching away from Frontpage page includes to all server side includes.

#104 qwerty

qwerty

    HR 10

  • Moderator
  • 8,604 posts
  • Location:Somerville, MA

Posted 08 February 2005 - 12:48 PM

You could add this to your .htaccess
CODE
AddHandler server-parsed .shtml .htm


#105 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 08 February 2005 - 03:15 PM

Yes it would work Bobette.

As would Qwerty's solution, if your host allows that type of manipulation.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

SPAM FREE FORUM!
 
If you are just registering to spam,
don't bother. You will be wasting your
time as your spam will never see the
light of day!