Redirect Code Needed.
-
Hi,
Please help me redirect the following pages in htaccess.
https://www.mydomain.com/FolderA/FolderB/number-of-pages.html to
**https://www.mydomain.com/FolderA/FolderC/FolderB/number-of-pages.html **
I want to redirect atleast 50 pages like this.
Please help
Thanks
-
Hi Kashif,
Following this structure should get it done.
RewriteRule ^subdirectory/(.*)$ /anotherdirectory/$1 [R=301,NC,L]
For your example it would be like
RewriteRule ^FolderA/FolderB/(.*)$ /FolderA/FolderC/FolderB/$1 [R=301,NC,L]
For less then 100 redirects it "may" also be prudent to do them individually. I say this because it makes it very obvious what is going on if you ever need to edit it again. I would use Excel or OpenOffice to create a spreadsheet then just concatenate the cells together, following this example;
Redirect 301 /path/to-old-url https://www.mydomain.com/path/to-new-url
Ref site: http://coolestguidesontheplanet.com/redirecting-a-web-folder-directory-to-another-in-htaccess/
Hope this helps,
Don
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Is it a good practice to reduce number of redirections (301) after a period of time?
Is it good to use disavow tool and get rid of old URLs i.e. links for pages and posts which we have deleted from our website and added 301 on them?
On-Page Optimization | | Ravi_Rana0 -
Redirecting deleted posts 301 vs 302
There is a category on WP where job ads are posted. when a post got deleted I would like to pass 404 error page and redirect all those deleted posts to specific category. I found WP plugin Auto Redirect 404 in 301 for Trashed Posts which does redirect deleted post to specific URL. But posts which are in the trash (not permanently deleted) will get 302 redirects. Those deleted permanently will get 301 redirects. Should I try editing this plugin or find another why? Maybe there is similar way with Redirection plugin?
On-Page Optimization | | OVJ0 -
Redirecting https pages
If I add 301 redirects from the https versions of the root domain to the http:www.website.com (canonical version), will this prevent users from being able to access the https version? I believe the https version is only accessed once users log into the site. Thank you!
On-Page Optimization | | HiddenPeak0 -
Reverse 301 redirect - how will that work?
Hi We have done some testing where we have changed our URL to a new name and 301 redirected the old to the new. It has now been decided to go back to the old url again but is there an seo risk to this? Will all the inbound links that as redirected in the first change be lost or?
On-Page Optimization | | AndersDK0 -
Redirect
Some time ago I have created a category which I have deleted later. Now seomoz is showing me that its not found, obviously...what would be the best practice to redirect this category to a page? I know that with 301, but how, can I do it when I deleted that category:-(
On-Page Optimization | | VillasDiani0 -
Should we consider redirecting a high ranking subdomain page to our homepage?
My site bluecotton.com sells custom printed t-shirts. Our DA is 46. Our homepage is PA 55. The design studio is where users create their designs. Over the years the design studio has received a lot of fan fair including links from gizmodo and adobe. When I rank against our biggest competitors customink, ooshirts, uberprints.com I find that our domain as a whole doesn't look all that great. However, when I look at the history of our subdomain I see that we are more trusted and credible than all of our competitors. We have 10k links pointing to the design studio. Here is my question. What if I did 301 redirect of bluecotton.com/studio.html to bluecotton.com? Then I created a new url for the DS. This would not cause users any problems. In fact for many they would get more context around what we are trying to do and what we offer. Is this crazy? I never find results in google for the design studio. It always shows our home. That is pretty much what happens to all of our competitors on the higher traffic terms that are driving real sales. So why do i ask? If my subdomain is more valuable becuase of the design studio links then I wonder if I redirected it to the homepage if it would supercharge my homepage and propel is forward in the serps. Thoughts?
On-Page Optimization | | bradwayland0 -
Do I need a robots meta tag on the homepage of my site?
Is it recommended to include on the homepage of your site site? I would like Google to index and follow my site. I am using WordPress and noticed my homepage is not including this meta tag, therefore wondering if I should include it?
On-Page Optimization | | asc760 -
Advice needed about site
I would like to get advice about the site http://www.wb-3d.com regarding what we should do to get it highly on Google. This seems to be a tough one as there is not enough content on the site. I would immensly appeciate any suggestion to improve the rankings. Specifically, what we should tweet and update on facebook. Thanks
On-Page Optimization | | seoug_20050