1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

HELP: how to redirect url that contains certain keywords using htaccess

Discussion in 'Programming' started by geekos, Apr 7, 2018.

  1. #1
    hi
    how to redirect url that contains certain keywords using htaccess
    ex:
    -www.website.com/keyword/ -> redirects to www.website.com
    -www.website.com/keyword1keyword2/ ->redirects to www.website.com
    Code (markup):

    SEMrush
     
    geekos, Apr 7, 2018 IP
    SEMrush
  2. phpmillion

    phpmillion Member

    Messages:
    141
    Likes Received:
    11
    Best Answers:
    4
    Trophy Points:
    35
    #2
    It depends.

    If your keyword is "static" (I mean you only want to redirect keywords that you already know), something like
    RewriteRule /keyword/ http://www.website.com
    Code (markup):
    should work.

    If you need to redirect keywords based on some rule (like keyword contains a specific letter or symbol, etc.), just use preg_match on the rule above.
     
    phpmillion, Apr 9, 2018 IP