Little redierct help

Discussion in 'Programming' started by ofir12, Nov 6, 2009.

  1. #1
    Hey ,

    I have simple ( I think ) question about redierction.

    Lets say I have domain xxx.com .

    Now I have dir on it lets say xxx.com/blog/

    Now I want every page (even if not exist) will redierct to xxx.com


    Example : if someone will type xxx.com/blog/xyxy.html he will be rediercted to xxx.com.


    I think the soultion may come with .htaccess file but I am not sure how.

    Kindly help:)

    Thank you.
     
    ofir12, Nov 6, 2009 IP
  2. emed

    emed Peon

    Messages:
    70
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you can put this on your .htaccess file:
    ErrorDocument 404 /

    and every error will show the homepage, but the address bar wont change (xxx.com/blog/xyxy.html)

    if you need to show only the xxx.com add this:
    ErrorDocument 404 /404.php

    and put this on the 404.php file:
    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://xxx.com");
    ?>
    PHP:
     
    emed, Nov 6, 2009 IP
  3. thr3146

    thr3146 Active Member

    Messages:
    182
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #3
    if you would like to just throw in a file in each folder that does not currently have content you can put in a meta re-direct like this... <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yoursite.com">
     
    thr3146, Nov 6, 2009 IP