redirect from dynamic url to friendly urls

Discussion in 'Apache' started by Mascka, Jun 9, 2007.

  1. #1
    i dont know how to redirect from
    w w w.4pcsoft.com/?cat=Audio to http://www.4pcsoft.com/Audio.html

    Google index houndreds of dynamic links and i need an 301 redirect with htaccess to friendly link.
    i try RewriteRule ^/?cat=(.*) /$1.html [R=301,L] but it not work

    10x
     
    Mascka, Jun 9, 2007 IP
  2. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #2
    you're doing it backwards. you need to look for audio.html and then redirect to blah.php?cat=audio

    example .htaccess
    
    RewriteEngine on
    RewriteRule ^([A-Za-z0-9-_\+]+).html$ index.php?cat=$1
    
    Code (markup):
    this should accept (anything).html formatted with chars and _ + or -

    eg: poon_and_pie.html
    something+else.html
    foo-bar.html
    foo.html
     
    ansi, Jun 9, 2007 IP