Redirect to subfolder. Disallow direct subfolder access
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.
-
Hello, There's a StackOverflow thread with a similar question at: Url rewrite subfolder to root and forbid accessing subfolder Let us know if that helps. Thank you. 0
Please sign in to leave a comment.
Comments
1 comment