URL Rredirecting Using .htaccess

Discussion in 'Apache' started by Nina Rose, Feb 19, 2015.

  1. #1
    How do i redirect URL: example.com/page1 to example.com

    I mean, i want to redirect any specific page of my site to homepage.

    Please Help.

    Thank You.
     
    Nina Rose, Feb 19, 2015 IP
  2. Profitup

    Profitup Greenhorn

    Messages:
    50
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    13
    #2
    Add this string to your .htaccess file:

    Redirect 301 /example.com/page1 http://www.example.com/
     
    Profitup, Feb 19, 2015 IP
  3. nasium

    nasium Active Member

    Messages:
    114
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    90
    #3
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule (.*) / [R=301,L]
    Code (markup):
     
    nasium, Mar 16, 2015 IP
  4. Blesta.Store

    Blesta.Store Active Member

    Messages:
    97
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    80
    #4
    I use PHP.
    <?php
    header("Location: ../
    die();
    ?>
    
    or
    
    <?php
    header("Location: http://url.com
    die();
    ?>
    Code (markup):
     
    Blesta.Store, Apr 21, 2015 IP