htaccess keyword redirect? (Please help out)

Discussion in 'Apache' started by shenron, May 25, 2007.

  1. #1
    Hi everyone!

    I'm having a little issue with one of my sites:

    I need to block access to some pages of the site or redirect users back to homepage if a specific keyword appears at the URL.

    I explain better:

    I have w_ww.whatever.xyz

    While browsing the pages or using the search function of the site I need to redirect the user(s) to a particular unauthorised page, homepage, other site or wherever if a keyword is present.

    Example:

    w_ww.whatever.xyz/tag/whatever
    w_ww.whatever.xyz/tag/?keyword=whatever

    And each time whatever is present I want to redirect users to someplace.

    What do I need to do at the htccess file? :eek:

    Thx a lot!
     
    shenron, May 25, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Options +FollowSymLinks +Indexes
    RewriteEngine on
    RewriteBase /
    RewriteRule ^tag/([^.]+)$ tag/index.php?keyword=$1 [L]

    And link to the shorter URL.

    If it messes the script up, add an extension, or a / after the keyword.
     
    Nintendo, May 25, 2007 IP
    shenron likes this.