How do I 301 redirect a number of pages to one page
-
I want to redirect all pages in /folder_A /folder_B to /folder_A/index.php.
Can I just write one or two lines of code to .htaccess to do that?
-
Strange.
How about something like this:
RewriteRule ^folder_B/(.*)$ /folder_A/index.php [R=301,L]I'm not an expert in RegEx or Rewrite rules, so there could be som errors in there
Good luck!
-
Its actually phpLD and I'm trying to do it with .htaccess.
For some reason the code below didn't work for me
RedirectMatch 301 /folder_A/folder_B/(.*) /folder_A/index.php
-
Nima what platform are you using?
Is it PHP or ASP? And any specific CMS?
With wordpress all you have to do is to install a redirection plugin and you are good to go... but if you have a normal php based website you have to write the following code in your .htaccess file.
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html
_ Redirect 301 /oldpage2.html http://www.yoursite.com/newpage.html_
If you are on a ASP platform you have to look in to your IIS and then work accordingly.
-
Hi Nima.
Is this perhaps possible to do with a RedirectMatch? Something like:
RedirectMatch 301 /folder_A/folder_B/(.*) /folder_A/index.php
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
-
Our protected pages 302 redirect to a login page if not a member. Is that a problem for SEO?
We have a membership site that has links out in our unprotected pages. If a non-member clicks on these links it sends a 302 redirect to the login / join page. Is this an issue for SEO? Thanks!
Technical SEO | | rimix1 -
Is there a way to set up 301 auto redirects from 404s
some of our pages under a specific website section gets deleted from another data source and we want to resolve the problem of 404s can we set up automated 301 redirects to the main page as soon as one of these pages are deleted
Technical SEO | | lina_digital2 -
Redirect 301 & Wild Cards
Afternoon All! Question, I am having trouble getting my head around redirects and I am wondering if someone could help me on this.... We recently changed our website and although were using the same database, were using a different URL structure. So for example... Old URL siteurl.com/products/product/moredetails/merlin.id1553.html
Technical SEO | | scottiedog
New URL siteurl.com//vertigo/dl/product.php?p=1553 As you can see the product has the same ID number, just in a different directory. What I'd like to happen is.... If you go too siteurl.com////.idXXXX.html then you are 301'd too siteurl.com//vertigo/do/product.php?p=XXXX Obviously XXXX is the ID number of the product in our database. Any thoughts? I need help! Thanks in advance.0 -
What is the difference between 301 redirect to 404 vs just 404.
A bunch of pages on my site are set to 301 redirect to our 404 page. Intuitively, I feel like they should all just 404 from the page's url and not redirect to the 404 page. How do I explain to my developer that they should not redirects but should just 404? Is there much of a difference between the redirect first vs 404 first? Thanks!
Technical SEO | | gaytravel0 -
One page with multi syndicate feeds
Hi, Just a quick note. I hope someone is able to advise. To cut a long story short I have a page/s that receive multiple syndicated feeds.
Technical SEO | | daveupton
We are using the content for its value to visitors. Am very happy to cross domain rel=canonical the source and not incur any of Panda's wrath but would like to know if one can add multiple rel-canonicals to one page to reference multiple sources. Appreciate your help. Many thanks Dave Upton0 -
301 category page to Homepage to increase authority
Hello all, Hope everyone is well and are enjoying the summer. I am currently working with a site: www.corporatehealth.co.uk and have been trying to rank on the first page for the keyword occupational health. currently we are ranking on the second page: http://www.google.co.uk/search?q=occupational+health&pws=0&gl=uk#q=occupational+health&hl=en&pws=0&gl=uk&prmd=ivnsb&ei=38dUTuHCDdGKhQetqZn5BQ&start=10&sa=N&bav=on.2,or.r_gc.r_pw.&fp=80a9548917d021a&biw=1920&bih=878 I understand I need to get more links pointing to the site and page itself. My idea was to do a 301 redirect from the occupational health page to the homepage and add occupational health content to the homepage as ultimately they are an occupational health service supplier. Was hoping to get anyones thoughts on the issue. Thanks in advance Shehzad
Technical SEO | | Gareth_Cartman0 -
Permanent 301 redirects vs canonical urls?
Im moving a website that was .php to wordpress with a few static HTML pages. Which is better use permanent 301 redirects and delte the old pages, leave the old pages and use canonical urls and 301 redirects or something else?
Technical SEO | | senith0