Help with .htaccess

Discussion in 'PHP' started by nat000, Nov 5, 2009.

  1. #1
    Please help with the following htaccess commands.

    1)

    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^$ search.html [QSA]

    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^/$ search.html [QSA]

    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^([a-z][a-z])$ search.htm?key=$1 [QSA]

    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^([a-z][a-z])/$ search.htm?key=$1 [QSA]

    What these lines do and why each line repeats two times?


    2) RewriteCond %{REQUEST_FILENAME} !/data/
    rewriterule ^(.*)\.htm data/$1_%{QUERY_STRING}.htm

    What these lines do and what is $1?

    3) RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{HTTP_REFERER} q=
    Rewriterule ^(.*)\.htm index.php [E=key:%{REQUEST_FILENAME},L]

    What these lines do?




    THanks.
     
    nat000, Nov 5, 2009 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    First one:
    Lines do not repeat twice - they are a little bit different:
    ^$ and ^/$
    Thess lines redirect url somthing like /search/keyword to search.html?key=keyword
    For 2nd and 3rd I can't say anything, cause don't know for sure.
     
    AsHinE, Nov 5, 2009 IP