Htacces how Redirect 301, http://mysite.com/?staticpage to http://otherdomain.com

Discussion in 'PHP' started by basketmen, Mar 23, 2010.

  1. #1
    basketmen, Mar 23, 2010 IP
  2. superdav42

    superdav42 Active Member

    Messages:
    125
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Looks like you are doing everything right. You might have to escape the ? with
    Redirect 301 /\?staticpage http://otherdomain.com
    Code (markup):
    But I wouldn't think that would be necessary.
    You might want to check the placement of the file. Is it named ".htaccess" and located at root of your public_html or html folder? Do you use the .htaccess file for other things that are working correctly?
     
    superdav42, Mar 23, 2010 IP
  3. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Since this is in the PHP forum, why not just drop a
    
    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://www.example.com");
    exit();
    ?>
    PHP:
    at top? If you want only for ?staticpage, if(isset($_GET['staticpage']))?
     
    krsix, Mar 23, 2010 IP
  4. jc@ukzone.com

    jc@ukzone.com Guest

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This is how my .htaccess file looks:

    # send a 301 redirect if index.html is requested
    RewriteEngine On
    RewriteRule ^index.html$ http://otherdomain.com/ [R=301,L]

    hth
     
    jc@ukzone.com, Mar 23, 2010 IP