redirect using .htaccess

Discussion in 'Programming' started by guest, Dec 12, 2011.

  1. #1
    I want to redirect the below pages to a http://www.domain.com/status/
    http://www.domain.com/domeve.php?year=2000&month=03
    http://www.domain.com/domeve.php?year=2000&month=06
    http://www.domain.com/domeve.php?year=2000&month=08
    http://www.domain.com/domeve.php?year=2001&month=09
    http://www.domain.com/domeve.php?year=2011&month=06
    http://www.domain.com/domeve.php?year=2012&month=09
    http://www.domain.com/domeve.php?year=2012&month=10
    http://www.domain.com/domeve.php?year=2001&month=11
    http://www.domain.com/domeve.php?year=2002&month=01


    http://www.domain.com/search.php?page=2&sortby=name&ad=ASC&loc=Sth&np=0-10
    http://www.domain.com/search.php?page=2&sortby=name&ad=ASC&type=2&loc=Sth
    http://www.domain.com/search.php?page=2&sortby=name&ad=ASC&type=4&loc=Sth&np=11-50
    http://www.domain.com/search.php?page=2&sortby=name&ad=ASC&type=6&np=0-10
    http://www.domain.com/search.php?page=3&sortby=name&ad=ASC&loc=South
    http://www.domain.com/search.php?page=8&sortby=name&ad=ASC&np=51-99
    http://www.domain.com/search.php?type=2&loc=&np=11-50
    http://www.domain.com/search.php?type=2&loc=Sth&np=100+
    http://www.domain.com/search.php?type=3&loc=Nth&np=100+
    http://www.domain.com/search.php?type=3&loc=Nth&np=51-99
    http://www.domain.com/search.php?type=5&loc=Nth&np=100+&Submit=Search
    http://www.domain.com/search.php?type=5&loc=Nth&np=11-50&Submit=Search



    At present there is no domeve.php or search.php on the site so I just want to redirect any request that comes for search.php or domeve.php
    I want to achieve this by using wildcard.

    Any help much appreciated.


    Thanks
     
    guest, Dec 12, 2011 IP
  2. Toycel

    Toycel Peon

    Messages:
    243
    Likes Received:
    11
    Best Answers:
    4
    Trophy Points:
    0
    #2
    How to implement the 301 Redirect

    1. To create a .htaccess file, open notepad, name and save
    the file as .htaccess (there is no extension).

    2. If you already have a .htaccess file on your server,
    download it to your desktop for editing.

    3. Place this code in your .htaccess file:

    redirect 301 /old/old.htm http://www.you.com/new.htm

    4. If the .htaccess file already has lines of code in it,
    skip a line, then add the above code.

    5. Save the .htaccess file

    6. Upload this file to the root folder of your server.

    7. Test it by typing in the old address to the page you've
    changed. You should be immediately taken to the new
    location.

    Notes: Don't add "http://www" to the first part of the
    statement - place the path from the top level of your site
    to the page. Also ensure that you leave a single space
    between these elements:

    redirect 301 (the instruction that the page has moved)

    /old/old.htm (the original folder path and file name)

    http://www.you.com/new.htm (new path and file name)


    Found on ISitebuild
     
    Toycel, Dec 13, 2011 IP