301 Redirect

Discussion in 'Programming' started by dargre, Aug 23, 2007.

  1. #1
    Hi,
    I need to do fast 301 redirection

    I have:
    http:// www. domain.com/tags/tag_example/

    I need to redirect it (301) to:
    http:// www. domain.com/search/tag_example/

    What I do:

    RewriteCond %{REQUEST_URI} ^(.*)/tags/(.*)
    RewriteRule ^(.*)$ http:// www. domena.com/search/(.*) [R=301,L]

    However it's not working...
    I get:
    http:// www. domain.com/search/(.*)

    Appreciate your help.
     
    dargre, Aug 23, 2007 IP
  2. SoniCute

    SoniCute Active Member

    Messages:
    585
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    60
    #2
    What your control panel?you can do it from most available control panel like Cpanel,HSPERE,ISConfig etc.
     
    SoniCute, Aug 24, 2007 IP
  3. Tarkan

    Tarkan Peon

    Messages:
    491
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can alternatively use PHP:
    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://www.yourRedirect.com/");
    exit();
    ?>

    Or the proper way with htaccess:
    rewriteEngine on
    rewriteRule ^myphp\.php$ http://www.mysite.com/thenewredirect.php [R=301,L]
     
    Tarkan, Aug 24, 2007 IP
  4. m0nkeymafia

    m0nkeymafia Well-Known Member

    Messages:
    399
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    125
    #4
    In .htaccess do it like so:

    
    RewriteRule ^tags/(.*)/$ search/$1/ [R=301]
    
    Code (markup):
     
    m0nkeymafia, Aug 28, 2007 IP