0

Hello,

I have a website in Wordpress. Example: http://www.mysite.com
Than I developed a new theme for the website and I have created a new directory on server for developement and testing only. The URL is http://www.mysite.com/newsite/

Now Google scanned my this testing website and added URL from it. So google has added:
http://www.mysite.com/newsite/
http://www.mysite.com/newsite/products/
http://www.mysite.com/newsite/products/sample1/
http://www.mysite.com/newsite/products/sample2/
http://www.mysite.com/newsite/products/sample2/
http://www.mysite.com/newsite/about-us/
http://www.mysite.com/newsite/contact/

There are more than 100 pages so I cannot add 301 redirection for each URLs.

So I think to add a conditional HTACCESS rule for this.

So:
http://www.mysite.com/newsite/ will redirect to http://www.mysite.com/
http://www.mysite.com/newsite/products/ will redirect to http://www.mysite.com/products/
http://www.mysite.com/newsite/products/sample1/ will redirect to http://www.mysite.com/products/sample1/
...
and so on.

I have added this HTACCESS rule but this is not working:

RewriteEngine on
RewriteBase /newsite/
RewriteCond %{HTTP_HOST} ^newsite/\.
RewriteRule ^newsite/(.*)$ /$1 [L,R=301,QSA].

Please note that the root path (www.mysite.com) also contains Wordpress HTACCESS so if this may give problem?

Can anyone help me to create rule for this?

Thanks

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by bimaljr
0

Thanks for reply.
It's not working. I removed 2nd and 3rd line but still it's not working.

1

//301 Redirect Entire Directory
RedirectMatch 301 newsite/(.*) /$1

Edited by coreyavis

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.