1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

htaccess - redirect everything to new domain

Discussion in 'Apache' started by Kerosene, Sep 20, 2008.

  1. #1
    I need to redirect everything to a new domain. I want every page and directory on the old domain to point to my new index page.

    olddomain.com
    olddomain.com/blabla/
    olddomain.com/blabla.html
    TO
    newdomain.com


    htaccess nerds? plz suggest me.
     
    Kerosene, Sep 20, 2008 IP
  2. nimhost

    nimhost Active Member

    Messages:
    235
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #2
    search first on this forum because it's had been discussed many time :)
     
    nimhost, Sep 20, 2008 IP
  3. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #3
    Find me a thread with an htaccess example and I'll give you $1 :)

    The only ones I can find redirect the folder/filename as well (e.g olddomain.com/bla.html > newdomain.com/bla.html). This isn't what I want to do. I want to redirect everything on the old domain to my new domain's index page.
     
    Kerosene, Sep 20, 2008 IP
  4. Boulder

    Boulder Well-Known Member

    Messages:
    806
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    118
    #4
    Try using this one 301 redirect rule in a .htaccess file on old site.

    redirect 301 / http://www. new_site. com/


    the "/" represents everything in your old web directory and "newsite.com" without the spaces is the site where you need the redirect to go.

    Boulder
     
    Boulder, Sep 20, 2008 IP
    Kerosene likes this.
  5. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #5
    Thanks Boulder, but your example still carries the directory/page with it to the new domain. e.g olddomain.com/blabla/ is going to newdomain.com/blabla/

    I want everything to go to newdomain.com and NOT redirect any pages or directories from the old one. I hope I'm making sense :p
     
    Kerosene, Sep 20, 2008 IP
  6. Boulder

    Boulder Well-Known Member

    Messages:
    806
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    118
    #6
    Did you try it like this?

    redirect 301 / http:// www . new_site . com/index.html

    Or like this?

    redirect 301 / http:// www . new_site . com
     
    Boulder, Sep 20, 2008 IP
  7. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #7
    Kerosene, Sep 20, 2008 IP
  8. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #8
    SOLVED!
    RewriteRule (.*) [url]http://www.newdomain.com/[/url] [R=301,L]
    
    Code (markup):
    This is working. If anyone has a better suggestion, then I'm all ears.

    +rep for Boulder for contributing :)
     
    Kerosene, Sep 20, 2008 IP
    Boulder likes this.
  9. Boulder

    Boulder Well-Known Member

    Messages:
    806
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    118
    #9
    Great, glad you found a rule that makes it work as you need.

    Have a good one.
     
    Boulder, Sep 20, 2008 IP
  10. nimhost

    nimhost Active Member

    Messages:
    235
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #10
    look at this

    http://forums.digitalpoint.com/showthread.php?t=1033073&highlight=redirect+301
    http://forums.digitalpoint.com/showthread.php?t=1029375&highlight=redirect+301+nimhost
    http://forums.digitalpoint.com/showthread.php?t=979496&highlight=redirect+301+nimhost
    http://forums.digitalpoint.com/showthread.php?t=980589&highlight=redirect+301+nimhost

    want to say there is no such thread ?
    at least 4 thread i'm pasting and i found more about redirect 301
    you lazy
     
    nimhost, Sep 20, 2008 IP
  11. nimhost

    nimhost Active Member

    Messages:
    235
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #11
    this one same like this

    redirect 301 / http:// www.new_site.com/

    the one that boulder gave you

    it will redirect everything on your old site to your new site so even search engine will change the PR too which you had got for your old site to your new site

    redirect 301 means you completely remove your old site to your new site
     
    nimhost, Sep 20, 2008 IP