Is it possible (actually) to move a site from www.example.org/ to www.example.org/new/ using htaccess?

I'm wondering if you can upload a site to the root directory, but not make it already visible to the public (and to Google for SEO reasons). And what is the best thing for?

Is it possible with some rules in the .htaccess file that it looks like the site www.example.org/new/, and not www.example.org?

thank

+3
source share
4 answers

To redirect all links to www.example.org to go to www.example.org/new, add this to your .htaccess:

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteCond %{REQUEST_URI} ^/new/
  RewriteRule ^(.*) $1 [L]

  RewriteRule ^(.*)$ /new/$1 [L,R=301]
</IfModule>

. , . , , robots.txt(, , ). .

SEO , . :

RewriteRule ^corporateplan$ /corporate-services/corporate-plan [L,R=301]
+2

example.org, beta.example.org , . , Apache.conf, DocumentRoot.

0

. , , , - .

If this is a new site, I just protect it with a password with Apache mod_auth_ * modules. If this is a new version of an existing site, I will create a new site under a subdomain.

Update

In a shared hosting environment, your options are pretty limited. You must physically load the site in a folder newor otherwise overwrite the old site. In this case, nothing special is required.

0
source

You can disable robots with robots.txt. I do not know if this will help you, but I use this way.

0
source

Source: https://habr.com/ru/post/1753163/


All Articles