I have looked and looked and cant find the answer, I would greatly appreciate your help!!
I designed a website in a folder on a dummy domain, and forgot to add "noindex" and now its indexed, I need to redirect all pages in that folder to the index of the new domain. example: http: //dummysite/clientsfolder/ (I had to put space here because I can't post 2 links)
redirect to http://clientsnewdomain.com
all the code I have found redirects to http ://clientsnewdomain.com/clients folder, whether I place it in the /clientsfolder or the http://dummysite/ and then this results in a 404 page. Got into a mess here.
Also which is better to use to avoid this issue in the first place? in or a robots.txt?
Use that, in your /clientsfolder/.htaccess
:
RewriteEngine on
RewriteRule ^(.*)$ http://clientsnewdomain.com/$1 [R=301,L]
OR in the root .htaccess
:
RewriteRule ^clientsfolder/(.*)$ http://clientsnewdomain.com/$1 [NC,R=301,L]
The best place to avoid this issue in the first place is to use robots.txt.
But I prefer to use a folder protected by a password.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.