How To Redirect Specified UserAgent in Specified URLs to Specified URLs

Discussion in 'Apache' started by Budi Haryono, May 20, 2015.

  1. #1
    I have quest when, How To Redirect Specified UserAgent in Specified URLs to Specified URLs?

    e.g

    I want to redirect 301 with conditional:

    useragent: Firefox
    in my url1: http://sampledomain.com/old-urls1/']http://sampledomain.tld/old-urls1/
    in my url2: http://sampledomain.com/old-urls12/']http://sampledomain.tld/old-urls12/
    Code (markup):
    to

    new url1: in my url1: http://sampledomain.com/new-urls1/']http://sampledomain.tld/new-urls1/
    new url2: in my url1: http://sampledomain.com/old-urls2/']http://sampledomain.tld/old-urls2/
    I try this in .htaccess
    Code (markup):
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} googlebot [NC]
    RewriteRule ^/?this-is-url/?$ http://newurl.tld/this-url [L,R,NC]
    Code (markup):
    but not work


    Thanks so much
     
    Budi Haryono, May 20, 2015 IP