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
-
Redirect chains error on the home page URL
Hello Everyone, I'm getting redirect chains error on the home page URL:
On-Page Optimization | | Nikhil_Falcon
http://ebitdacatalyst.com in Wordpress. I've checked my redirection list in the plugin, and haven't found any redirections on http://ebitdacatalyst.com. Can anyone please help me in solving this issue? I don't know where from it's coming.0 -
Alot of 302 Redirects, what to do?
I'm currently auditing my companies website, and we encountered thousands of 302 redirects. The 302 pages are products page, which is a question and answer module at the bottom of each products page. What best practice should I do to get rid of the 302 redirects? add those pages to the .robots.txt? Or do individually and add a no index? This would help boost our rankings up correct?
On-Page Optimization | | petmkt0 -
Should I add canonical links to pages that are redirected?
Hello! I am a little confused concerning canonical links. I have several URLs that all access my page, but I redirect them all. A lot of places I am told to redirect them or use canonicals. Other places, I read that I should always use canonicals. What is the right way for me? If I should use canonicals as well as redirects, which links should I do this on? I redirect my pages like this: http to https:
On-Page Optimization | | hermanok
http://example.com -> https://example.com www to non-www:
https://www.example.com -> https://example.com Remove trailing slashes
https://example.com/ -> https://example.com Would-be 404-requests to index.php?p=$1
https://example.com/home -> https://example.com/index.php?p=home ( show as https://example.com/home ) Example:
http://www.example.com/home/ -> http://www.example.com/home/ -> https://example.com/home/ -> https://example.com/home -> https://example.com/index.php?p=home ( shows as https://example.com/home ) Thank you!0 -
# code not detected
Hi guys, my H1 code is like but Yoast SEO and Google Page Speed keeps saying that i do not have a H1 tag in my website, Is my code wrong? Keyword | Keyword2
On-Page Optimization | | kevinbp0 -
Redirect www.domain to domain
How do I redirect www.entrepreneurhandbook.co.uk to entrepreneurhandbook.co.uk The latter is an existing site. Thanks James
On-Page Optimization | | entrepreneurhandbook1 -
Help an SEO-DUMMY : ) Established hyphenated domain...redirect?!...new domain?!
Hello, everybody. I am definitely not an SEO specialist. My family owns a transportation business (since 2010) and i am the one responsible for the website (until we find a good SEO company). My question: Several years ago i did not know much about SEO and have chosen a domain name www.airporttransportation-limo.com (it is not the actual domain...just an example...i'm not sure if i can post the real website here) and another domain that is just the name of our company (it also has hyphen in it). Both websites are still doing good and we receive quite a bit of traffic, but i read more an more about how hyphenated domains and domains with more then two worlds can be bad for your SEO/business/traffic. I feel like the websites are stuck and not moving up any more..could that be because of the hyphens? I registered another domain that is the name of our company (which is well known by now) without any hyphens. Now i have no idea what to do. Should i redirect both old domains (old websites are different and do not have duplicate content) to the new one, or should i just redirect the old domain (just the name of our company with hyphen) to a new one (without hyphen) and leave the www.airportransportation-limo.com as is... Or maybe i should register another domain without any hyphens (two words only) and redirect the www.airporttransportation-limo.com to it... I am very nervous to make any changes and loose all the traffic. My family will kill me. Please help! I'm lost!
On-Page Optimization | | KL20140 -
Meta Title in Google does not match the HTML meta title I have coded in a site
I have a client site that is pulling a meta title that is not in his code. I am using Yoast for the titles and descriptions on this site. Not 100% sure why Google is not listing the title we have in place. Could the code be pulling from somewhere else? Is there a fix for this?
On-Page Optimization | | Bryan_Loconto0 -
301 Redirects From a URL without Keyphrases to one With Keyphrases
I have a client that sells services. Each service offered currently has a URL structure like this: www.companyname.com/product/asp$view-id-page3022-item-24 These pages are pretty old, and I would love to have a more user-friendly URL like this: www.companyname.com/product/purple-swatch-watch If I rename the URL and do a 301 redirect, what impact will that have on search? Ideally, this page will be optimized for "purple swatch watch", but the current URL structure is so... well, you know. My apologies if this has been answered before. I tried looking through archived of 301 issues, but lost hope after my first 10 or so attempts at answered didn't help this specific issue.
On-Page Optimization | | ericav0