1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Quick htaccess redirect from subfolder?

Discussion in 'BlackHat Lounge' started by spaceboos, Mar 4, 2016.

  1. spaceboos

    spaceboos Junior Member

    Joined:
    Sep 19, 2015
    Messages:
    107
    Likes Received:
    7
    Home Page:
    Could someone please tell me how to use .htaccess to redirect the following:

    mydomain.com/subfolder to
    anydomain.com

    I am sure this is a stupid question but I have been looking for hours and haven't found an answer yet.
     
  2. JasonS

    JasonS Jr. VIP Jr. VIP

    Joined:
    Sep 15, 2012
    Messages:
    3,034
    Likes Received:
    929
    Try this create .htaccess file in subfolder and paste the below code into it.
     
  3. renzuken

    renzuken Junior Member

    Joined:
    Sep 9, 2009
    Messages:
    162
    Likes Received:
    66
    Location:
    /cat/proc/
    this is safer
    put it on .htaccess
     
  4. spaceboos

    spaceboos Junior Member

    Joined:
    Sep 19, 2015
    Messages:
    107
    Likes Received:
    7
    Home Page:
    do I put this in subfolder
    or I write in subfolder / anydomain in my domain ,htaccess
     
  5. renzuken

    renzuken Junior Member

    Joined:
    Sep 9, 2009
    Messages:
    162
    Likes Received:
    66
    Location:
    /cat/proc/
    its should be on root folder eg. /home/user/public_html/.htaccess
     
  6. JustUs

    JustUs Power Member

    Joined:
    May 6, 2012
    Messages:
    626
    Likes Received:
    585
    Code:
    ## redirect blog to /blog
    RewriteCond %{HTTP_HOST} www.somesite/blog/
    RewriteCond %{REQUEST_URI} !^/blog
    RewriteRule ^(.*)$ blog/$1 [L]