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 better to shorten my existing url to use only keyword after domain with a 301 redirect from existing url
I have a long existing URL that has included my key word but the url has about 5 additional words in the text ( eg url would have " /super widgets in stock at the widget store " as url text after domain. keywords is super widget The URL was at the top of search results for my keyword for many years until recently. Is it better to shorten my url text to now use only my keyword " /super-widgets " after the domain with a 301 direct from my existing url to optimize it Thanks
On-Page Optimization | | mrkingsley2 -
Need Professional Help with Site Structure, Page Authority, and Internal Linking
We are a 10 year + small (1000 pages) niche ecommerce site (Magento) that has recently lost rankings to a competitor. We out perform them in every metric so I do not understand them leap frogging us to the top spot. This has forced me to look at my site structure, page authority (rank), and internal linking. After reviewing a moz crawl issues report, here are some of my observations: Root domain has a PA of 40 Top 3 $ Category pages have a PA of 22, 18, 18 Multiple meaningless blog posts and other category/product pages have PA’s of 30+ Here is a screenshot of the crawl report with internal links, links, etc showing. I need some help - thoughts, suggestions, next steps in analysis?
On-Page Optimization | | SammyT0 -
When, if ever, would you need to use: example.com/en
Is there any reason to have /en on your website if your website is only in English? Or is it worth having in case you are preparing to translate into other languages? And is there any advantage to being: en.example.com over example.com/en Thanks
On-Page Optimization | | CosiCrawley0 -
How can I redirect anything after the article url to main article?
Hello everyone, When someone visits my websites article like http://www.website.com/article-title/lol , it give to 404 page error. But when someone http://www.website.com/article-title/ , it shows the article. The word "lol" can be changed to anything. I would like that to be redirected to the main article. Example: Someone visits website.com/article-title/lol, they should be redirected to website.com/article-title/ Is it possible to do so? If yes, please tell me how. Note: I'm using WordPress Thank you
On-Page Optimization | | hakhan2011 -
301 redirects. If new website is a different business does it still send link authority?
Hi Guys. I'm a music producer and studio owner. I want to start a new business for online music mixing. Instead of starting from scratch I want to use a 301 redirect from my previous site that has built up a little authority over the years. However, the old site is purely for my music studio, there is no mention of online mixing services. Will Google consider this 'odd'? Pass less link juice? Or perhaps pass no authority at all if Google 'decides' the 2 business are unrelated? Cheers in advance guys. Isaac.
On-Page Optimization | | isaac6630 -
Traffic Down - May Need Outside Help
Hi Moz Community - Our website (www.motivators.com) experienced a small traffic drop in mid-March. This was followed by a steady decline in traffic through May, June and July. Please note that a site redesign went live on April 4th. Starting in mid-July, we began implementing aggressive site improvements (mostly based upon site speed), but our traffic is still down. Can anyone recommend a service or company that can look at our site and determine the root cause / more strategies for improvement? Thanks for your suggestions!
On-Page Optimization | | Motivators0 -
23000 Links are not found- Should I redirect them?
Hi I have been deleting product links from my website but never redirect them. On my google webmaster, it shows there is total 23000 products are not found. Should I redirect them all back to the home page? For the pages with soft 404 response.. should I also redirect those original URL back to home page ? Thanks
On-Page Optimization | | ilovebodykits0 -
Removed listings: 404, internal links or redirect?
For a classifieds web site with medium/high turnover for the various listings: How would you deal with pages of removed listings? a) would you be "honest" and return a 404 since the listing is not available anymore? b) would you maintain historical data about deleted listings so that you can try and 301 redirect to a relevant search results page? c) would you keep the page alive (maybe add a noindex meta tag?) and show links to multiple relevant search results pages in an effort to strengthen internal linking?
On-Page Optimization | | seo-cat0