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.

http://www.domain.com http://domain.com http://www.domain.com/idex.htm etc

Discussion in 'Apache' started by Jayess, Jan 11, 2005.

  1. #1
    Jayess, Jan 11, 2005 IP
  2. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try the following in your .htaccess

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain.com$
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent]
    RewriteRule ^/index.html$ http://www.domain.com [R=permanent, L]

    The first rule should redirect every request for domain.com/file.ext to www.domain.com/file.ext
    The second redirects /index.html, with or without www, to www.domain.com

    You may need to play about with it a bit, but I think that this should do what you're after.

    Cheers

    John
     
    johnt, Jan 11, 2005 IP
  3. Jayess

    Jayess Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    500 error!

    I obviously changed the domain.com to my own domain and the index.html to my page name.....Any ideas?
     
    Jayess, Jan 11, 2005 IP
  4. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It's the last line, rewriting index.html, that is wrong, but I can't get it to work either I'm afraid.
    If you remove that line, then it will correctly redirect from domain.com to www.domain.com, but that still leaves you with the problem on index.html

    Anyone else ?

    John
     
    johnt, Jan 12, 2005 IP
  5. Jayess

    Jayess Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The first part(s) do indeed work, thank you. Anyone else know how to move a user/robot from index.html to the root of the domain?
     
    Jayess, Jan 12, 2005 IP
  6. Volknet

    Volknet Peon

    Messages:
    609
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I want to do a similar thing but all www. volknet .com requests to be pushed to http:// volknet .com
    So would this work:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain.com$
    RewriteRule ^(.*)$ http://domain.com/$1 [R=permanent]

    ?
     
    Volknet, Jan 19, 2005 IP