Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Redirect to subfolder. Disallow direct subfolder access

Discussion in 'Bind / DNS / Nameserver Issues' started by codplay, Jul 24, 2017.

  1. codplay

    codplay Registered

    Joined:
    Jul 24, 2017
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    united states
    cPanel Access Level:
    Website Owner
    Folder structure

    -public_html

    -magsandbox
    -app
    - pub
    - ....

    -magstage
    -app
    - pub
    - ....

    -magquality
    -app
    - pub
    - ....
    In public_html/.htaccess, I have following rule

    RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.domain.com$
    RewriteCond %{REQUEST_URI} !magstage/
    RewriteRule (.*) /magstage/$1 [L]
    This has been working perfectly so far. domain.com redirect to domain.com/magstage behind the scenes and my site is accessible.

    But from SEO perspective I have a duplication issue.

    domain.com and domain.com/magstage are both accessible for crawling and both are the one and same magento installation.

    How can I allow the redirect to subfolder but at the same block the subfolder access?

    I tried various combination adding htaccess in root as well as in subfolder. either the site goes down OR goes in a loop with both redirecting to each other.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    codplay likes this.
Loading...

Share This Page