SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thoughts on 301 Redirects

    I've done a lot of searching around forums, google, etc. trying to decide the best ways to utilize 301 redirects the "right" way and I've got a few different methods for different purposes, but I came across a question that perplexed me a bit.

    What I want to do is redirect an entire subdirectory, which has about 25 pages in it.

    For hypothetical purposes we'll say the website is http://domain.com/

    What I want to do is redirect the subdirectory: http://domain.com/abc/ and its contents:

    http://domain.com/abc/a.html
    http://domain.com/abc/b.html
    http://domain.com/abc/c.html etc. etc.

    to a new subdirectory: http://domain.com/def/ that would have:

    http://domain.com/def/a.html
    http://domain.com/def/b.html
    http://domain.com/def/c.html etc. etc.

    What I was thinking was to use a redirect in the .htaccess file

    Code:
    Redirect /abc /def
    Do you think that would be the best way to redirect the entire directory to a new one or would there be a better way? or should I just:

    Code:
    <%@ Language=VBScript %>
    <%
    ' Permanent redirection
    Response.Status = "301 Moved Permanently"
    Response.AddHeader "Location", "http://www.website.com/"
    Response.End
    %>
    On all of the pages. This is one I use for single pages, because I know it poses no problems, but I'd hate to do it 25 times..

    Or something else perhaps...

    My main goal is to improve the permalink structure for SEO purposes, but I don't want to hurt anything in the meantime by using the wrong kind of redirect.

    Any input would be appreciated!
    Last edited by TechnoBear; Apr 5, 2012 at 04:19. Reason: Example domain changed and unlinked

  2. #2
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,088
    Mentioned
    256 Post(s)
    Tagged
    5 Thread(s)
    Please don't use a real domain in your examples, and please remember to turn off automatic parsing of URLs if you want to include http:// or www.
    Take plenty of exercise – walk round and round the garden
    or
    sign up now for the Isle of Jura 10K or Half Marathon!

  3. #3
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by TechnoBear View Post
    Please don't use a real domain in your examples, and please remember to turn off automatic parsing of URLs if you want to include http:// or www.
    My apologies, when I wrote it, I didn't have the links. Will pay more attention in the future.

    (Also with the real domains)

  4. #4
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,088
    Mentioned
    256 Post(s)
    Tagged
    5 Thread(s)
    That's OK. It's not just aimed at you, it's a wee reminder to anybody who might reply, too.
    Take plenty of exercise – walk round and round the garden
    or
    sign up now for the Isle of Jura 10K or Half Marathon!

  5. #5
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,039
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    I would go with

    Code:
    Redirect 301 /abc /def
    (if you omit 301, Apache will use the default redirect status, which is 302 -- temporary redirect, which is not what you want, see http://httpd.apache.org/docs/2.0/mod....html#redirect)

    No need to start the VBEngine if you already know what you want in the .htaccess -- just let Apache figure it out
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  6. #6
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ScallioXTX View Post
    I would go with

    Code:
    Redirect 301 /abc /def
    (if you omit 301, Apache will use the default redirect status, which is 302 -- temporary redirect, which is not what you want, see http://httpd.apache.org/docs/2.0/mod....html#redirect)

    No need to start the VBEngine if you already know what you want in the .htaccess -- just let Apache figure it out
    Thanks. Shouldn't hurt anything as far as google rankings, seo or anything along those lines should it?

  7. #7
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,039
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by BradKCulp View Post
    Thanks. Shouldn't hurt anything as far as google rankings, seo or anything along those lines should it?
    I'm not big on that subject, but from what I've heard it indeed shouldn't; although I've also heart people say you may loose a little bit of link juice, but that the amount is negligible.
    Again, I'm really not big on the subject, so I can't be 100% sure here.
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  8. #8
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ScallioXTX View Post
    I'm not big on that subject, but from what I've heard it indeed shouldn't; although I've also heart people say you may loose a little bit of link juice, but that the amount is negligible.
    Again, I'm really not big on the subject, so I can't be 100% sure here.
    Okay, thanks. I haven't had problems with redirects before, but I've never redirected an entire directory. Sales have been down on the particular site I'm doing it on-seasonal sales, so if I have problems there's plenty of time to get it back up.

    Thanks for the help. I appreciate it greatly!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •