simple mod rewrite question

Discussion in 'Apache' started by magoo, Oct 3, 2007.

  1. #1
    This would seem like an easy question to answer but I have searched all the examples I can find and nowhere have I seen it. What I'm trying to do is rewrite the base url www.mysite.com to display www.mysite.com/mypage.php

    can anyone tell me how to do this?
     
    magoo, Oct 3, 2007 IP
  2. magoo

    magoo Peon

    Messages:
    474
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Nobody? surely this can't be too difficult?
     
    magoo, Oct 3, 2007 IP
  3. chickens

    chickens Peon

    Messages:
    242
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The easiest solution would be to use PHP. If you create an index.php file and use the header function it should do exactly what you are looking for.

    <?php
    header("location:mypage.php");
    ?>
    Code (markup):
    If you want to just many another file be the "index" and load every time you go to a site you can use the directory index option in .htaccess.

    Directory Index mypage.php
    Code (markup):
     
    chickens, Oct 3, 2007 IP
  4. magoo

    magoo Peon

    Messages:
    474
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The way the site has been coded means I have to use the rewrite option sadly. Does anyone know how to do this?
     
    magoo, Oct 3, 2007 IP
  5. greys

    greys Peon

    Messages:
    49
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You need to do something like this:

    RewriteEngine on
    RewriteRule ^/$ mypage.php [R]
    Code (markup):
     
    greys, Oct 3, 2007 IP