htaccess redirect

webnise

Regular Member
Joined
Dec 21, 2009
Messages
296
Reaction score
121
I was developing a site in a subfolder so the url was look like:

http://www.site.com/website/makeuphair
http://www.site.com/website/treatment
etc

and these URLs have been indexed by search engines.

Now, I am looking for a general rule for .htaccess that can redirect all the URLs inside the /website folder to relevant pages on the main site. That is,

http://www.site.com/website/makeuphair
should redirect to : http://www.site.com/makeuphair

http://www.site.com/website/treatment
should redirect to: http://www.site.com/treatment

Can anybody help me here?
 
Anything but I would prefer a generic rewrite rule so that I don't have to write a 301 redirect of every page.
 
Redirect 301 /website/treatment http://www.site.com/makeuphair

The first part should be relative to the .htaccess file, the second part should be the full url of the new page. In the example above the htaccess file would be in the main directory of the main domain (ie public_html or www depending on server.

I was developing a site in a subfolder so the url was look like:

http://www.site.com/website/makeuphair
http://www.site.com/website/treatment
etc

and these URLs have been indexed by search engines.

Now, I am looking for a general rule for .htaccess that can redirect all the URLs inside the /website folder to relevant pages on the main site. That is,

http://www.site.com/website/makeuphair
should redirect to : http://www.site.com/makeuphair

http://www.site.com/website/treatment
should redirect to: http://www.site.com/treatment

Can anybody help me here?
 
This is only necessary if you have built links to the original location and want to pass on link juice otherwise just move the content to the new Url location on your website, delete the old links and update your sitemap.

If you still need to do a redirect anyway then you should have the option to do this in your host account control panel 'Redirect' icon/link/section. This will write the information for you directly into your htaccess file.
 
This is only necessary if you have built links to the original location and want to pass on link juice otherwise just move the content to the new Url location on your website, delete the old links and update your sitemap.

If you still need to do a redirect anyway then you should have the option to do this in your host account control panel 'Redirect' icon/link/section. This will write the information for you directly into your htaccess file.

I think this is a good advice regarding moving the content. I will try with htaccess first and if didn't work then I will remove the old links.

Thanks everyone :)
 
Back
Top