undefined
Skip to content
Moz logo Menu open Menu close
  • Products
    • Moz Pro
    • Moz Pro Home
    • Moz Local
    • Moz Local Home
    • STAT
    • Moz API
    • Moz API Home
    • Compare SEO Products
    • Moz Data
  • Free SEO Tools
    • Domain Analysis
    • Keyword Explorer
    • Link Explorer
    • Competitive Research
    • MozBar
    • More Free SEO Tools
  • Learn SEO
    • Beginner's Guide to SEO
    • SEO Learning Center
    • Moz Academy
    • SEO Q&A
    • Webinars, Whitepapers, & Guides
  • Blog
  • Why Moz
    • Agency Solutions
    • Enterprise Solutions
    • Small Business Solutions
    • Case Studies
    • The Moz Story
    • New Releases
  • Log in
  • Log out
  • Products
    • Moz Pro

      Your all-in-one suite of SEO essentials.

    • Moz Local

      Raise your local SEO visibility with complete local SEO management.

    • STAT

      SERP tracking and analytics for enterprise SEO experts.

    • Moz API

      Power your SEO with our index of over 44 trillion links.

    • Compare SEO Products

      See which Moz SEO solution best meets your business needs.

    • Moz Data

      Power your SEO strategy & AI models with custom data solutions.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Free SEO Tools
    • Domain Analysis

      Get top competitive SEO metrics like DA, top pages and more.

    • Keyword Explorer

      Find traffic-driving keywords with our 1.25 billion+ keyword index.

    • Link Explorer

      Explore over 40 trillion links for powerful backlink data.

    • Competitive Research

      Uncover valuable insights on your organic search competitors.

    • MozBar

      See top SEO metrics for free as you browse the web.

    • More Free SEO Tools

      Explore all the free SEO tools Moz has to offer.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Learn SEO
    • Beginner's Guide to SEO

      The #1 most popular introduction to SEO, trusted by millions.

    • SEO Learning Center

      Broaden your knowledge with SEO resources for all skill levels.

    • On-Demand Webinars

      Learn modern SEO best practices from industry experts.

    • How-To Guides

      Step-by-step guides to search success from the authority on SEO.

    • Moz Academy

      Upskill and get certified with on-demand courses & certifications.

    • SEO Q&A

      Insights & discussions from an SEO community of 500,000+.

    Unlock flexible pricing & new endpoints
    Moz API

    Unlock flexible pricing & new endpoints

    Find your plan
  • Blog
  • Why Moz
    • Small Business Solutions

      Uncover insights to make smarter marketing decisions in less time.

    • Agency Solutions

      Earn & keep valuable clients with unparalleled data & insights.

    • Enterprise Solutions

      Gain a competitive edge in the ever-changing world of search.

    • The Moz Story

      Moz was the first & remains the most trusted SEO company.

    • Case Studies

      Explore how Moz drives ROI with a proven track record of success.

    • New Releases

      Get the scoop on the latest and greatest from Moz.

    Surface actionable competitive intel
    New Feature

    Surface actionable competitive intel

    Learn More
  • Log in
    • Moz Pro
    • Moz Local
    • Moz Local Dashboard
    • Moz API
    • Moz API Dashboard
    • Moz Academy
  • Avatar
    • Moz Home
    • Notifications
    • Account & Billing
    • Manage Users
    • Community Profile
    • My Q&A
    • My Videos
    • Log Out

The Moz Q&A Forum

  • Forum
  • Questions
  • Users
  • Ask the Community

Welcome to the Q&A Forum

Browse the forum for helpful insights and fresh discussions about all things SEO.

  1. Home
  2. SEO Tactics
  3. On-Page Optimization
  4. How can I fix multiple 404 errors with Wildcard htaccess redirect

Moz Q&A is closed.

After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

How can I fix multiple 404 errors with Wildcard htaccess redirect

On-Page Optimization
3
12
5.6k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as question
Log in to reply
This topic has been deleted. Only users with question management privileges can see it.
  • Taiger
    Taiger Subscriber last edited by Apr 14, 2014, 5:46 AM

    Hi all I hope that someone can help....

    How can I fix multiple 404 errors with Wildcard htaccess redirect

    The url in question is:

    How can I fix multiple 404 errors with Wildcard htaccess redirect

    http://www.5starweddingdirectory.com/listing/search/Category/luxury_hotels_venues_uk_wedding_venues/exclusive_use_venues/letter/c

    http://www.5starweddingdirectory.com/listing/location/uk-england/bedfordshire-weddings/franklin-park

    http://www.5starweddingdirectory.com/deal/location/uk-england/chorley-weddings/curtis-bay

    etc, going to http://www.5starweddingdirectory.com/business

    the above is just a few examples, google webmaster is showing over  8.000 404 page not found errors.

    Thanks in advance.

    1 Reply Last reply Reply Quote 0
    • Taiger
      Taiger Subscriber last edited by Nov 18, 2014, 9:11 PM Nov 18, 2014, 8:15 PM

      Hi Denverish, thanks for your reply, been months since i looked at this problem. It has returned so trying to sort it out. the redirects mentioned did not work. so any suggestions.

      The CMS allows for 301 redirects via a form; place old url at the top of the form and the new url at the bottom and save,

      But as I am trying to create a wildcard 301 redirect, i am not sure what code to place in these fields..see pic

      tai

      MgrqdVB.png

      1 Reply Last reply Reply Quote 0
      • topic:timeago_earlier,5 months
      • Christy-Correll
        Christy-Correll Staff last edited by Jul 5, 2014, 9:30 PM Jul 5, 2014, 9:30 PM

        Hi Tai, were you able to implement Matt's suggestions?

        1 Reply Last reply Reply Quote 0
        • topic:timeago_earlier,2 months
        • Christy-Correll
          Christy-Correll Staff last edited by May 5, 2014, 4:21 PM May 5, 2014, 4:21 PM

          Hi Tai! Any update on this issue? Please let us know so we can help! Thanks.

          Christy

          1 Reply Last reply Reply Quote 0
          • topic:timeago_earlier,13 days
          • Taiger
            Taiger Subscriber last edited by Apr 22, 2014, 10:21 AM Apr 22, 2014, 10:21 AM

            Hi Matt, sorry for the delay in getting back.

            Just working on your suggestions, I will let you know if it works

            T

            1 Reply Last reply Reply Quote 0
            • Matt-Williamson
              Matt-Williamson @Taiger last edited by Apr 16, 2014, 5:55 PM Apr 16, 2014, 5:55 PM

              Using the redirectmatch directive to redirect the entire deal directory to deals should definitely work for your situation. You then just repeat for each - so for deals:

              RedirectMatch 301 /deal/(.*) /deals/$1

              1 Reply Last reply Reply Quote 0
              • Taiger
                Taiger Subscriber last edited by Apr 16, 2014, 9:31 AM Apr 16, 2014, 9:31 AM

                Hi Matt,

                RewriteEngine On
                RewriteRule ^listing/(.*)$ http://www.5starweddingdirectory.com/business/ [R=301,L]

                Did not work,

                other urls flagged up in Google WM are/deal/ new: /deals/

                http://www.5starweddingdirectory.com/deal/location/uk-england/buckinghamshire-weddings/newport-beach

                http://www.5starweddingdirectory.com/deals/

                thanks Matt

                Matt-Williamson 1 Reply Last reply Apr 16, 2014, 5:55 PM Reply Quote 0
                • Matt-Williamson
                  Matt-Williamson @Taiger last edited by Apr 16, 2014, 4:58 AM Apr 16, 2014, 4:58 AM

                  Hi Tai,

                  I understand what you are saying in regards to making it easier with all the different URLs, however you will need to specify some start point in terms of being one level down from the domain root else you are effectively placing a wildcard on the whole domain, which wouldn't work when you are still working on this domain. So you need to try to identify the few main category URLs such as /listing and so on in order to create a rule.

                  Did the redirect I give you work for all URLs apart from the one listed? It should have worked for that.

                  An alternative you can try is:

                  RewriteEngine On
                  RewriteRule ^listing/(.*)$ http://www.5starweddingdirectory.com/business/ [R=301,L]

                  1 Reply Last reply Reply Quote 0
                  • Taiger
                    Taiger Subscriber last edited by Apr 15, 2014, 3:49 AM Apr 15, 2014, 3:49 AM

                    Hi Matt, thanks again.

                    Yes we are trying to redirect old urls to the relevant pages.

                    As we have so many old urls from old cms system which had different url structures, to do a wildcard to catch all 404s would be great. (wordpress plugin wp redirection achieves this http://wordpress.org/plugins/redirection/)

                    RedirectMatch 301 ^/listing/.*$ http://www.5starweddingdirectory.com/business

                    But it did not redirect

                    http://www.5starweddingdirectory.com/listing/location/uk-england/essex-weddings

                    Thanks for your time on this.

                    Regards Tai

                    Matt-Williamson 1 Reply Last reply Apr 16, 2014, 4:58 AM Reply Quote 0
                    • Matt-Williamson
                      Matt-Williamson @Taiger last edited by Apr 14, 2014, 5:24 PM Apr 14, 2014, 5:03 PM

                      Hi Tai,

                      I had a look at your site homepage and from your examples I could see you have relative urls which can cause 404 errors and as you mentioned 8000 I thought this could be part of your problems - no domains in your main navigation links so /business rather than www.yourdomain.com/business in coding - so no base URL can cause this. I took one of your links you mentioned to check if your hrefs were relative.

                      Putting what I mentioned aside for a second do you just want anything that is /listing and /deal redirecting to /business?

                      Have you tried this for the listing example and repeat for the others such as /deal/:

                      RedirectMatch 301 ^/listing/.*$ http://www.5starweddingdirectory.com/business

                      1 Reply Last reply Reply Quote 0
                      • Taiger
                        Taiger Subscriber last edited by Apr 14, 2014, 4:47 PM Apr 14, 2014, 4:47 PM

                        Hi Matt, and thank you for your response.

                        Not sure if i understand the solution to this problem though. The http://www.5starweddingdirectory.com/listing/......./ are from old legacy urls, and we have many. I am not sure why google webmaster is still picking up these old urls. but having 8k old not found urls is a worry.

                        Regards Tai

                        Matt-Williamson 1 Reply Last reply Apr 14, 2014, 5:03 PM Reply Quote 0
                        • Matt-Williamson
                          Matt-Williamson last edited by Apr 14, 2014, 4:19 PM Apr 14, 2014, 4:18 PM

                          You can fix this issue much easier than trying to sort out redirects in htaccess. You are coming across this issue because your site uses relative URLs rather than absolute.

                          Example:

                          A relative URL isn't tied to a base URL so:

                          /business

                          Absolute would be:

                          www.5starweddingdirectory.com/business

                          Using relative means that when you visit a page your link is relative to that location so if I was on

                          www.5starweddingdirectory.com/business and visited the same llink it would become

                          www.5starweddingdirectory.com/business/business unless redirected.

                          Having to fix this issue in htaccess can get messy for this and it would be much simpler to change your nav links in the template of your site. I checked this was the case in your sites source code to be certain and you definitely use relative URLs.

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          1 out of 12
                          • First post
                            1/12
                            Last post

                          Got a burning SEO question?

                          Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


                          Start my free trial


                          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.

                          • See all categories

                          Related Questions

                          • UWPCE

                            Multiple H1s and Header Tags in Hero/Banner Images

                            I work on education websites, and our sites are being flagged by SEO and accessibility checkers for having multiple H1s. The home pages have the site name as an h3 in the hero image, and an aspirational headline (think: Be Like Mike) as an H1. The sub-pages have two H1s: one on the site name in the banner image, and the other on the page title. Note that the site name is very keyword-rich. If we were to remove the H1 and H3 tags from the hero/banner images, would it do any SEO harm? At the same time, we’d rewrite the H1 on the home page to be more keyword-focused. Any other options? I also read that it’s OK to have multiple H1s as long as it’s clear which H1 belongs to the heading area and which one belongs to the body area of the page. Thanks in advance!

                            On-Page Optimization | Jun 16, 2021, 8:12 PM | UWPCE
                            0
                          • crichardson1992

                            Should I redirect a popular but irrelevant blog post to the home page?

                            Hi. I'm trying to get my website; www.ciphr.com , to rank for keywords relevant to "HR Software" in the UK.  It's a highly competitive industry and we rank ~mid to low on page one for some of our ideal keywords that are highly relevant and high volume. Years ago we took the decision to blog about topics more loosely related to the world of work. One of our blog posts, about plants in the office https://www.ciphr.com/advice/plants-in-the-office/   is popular. It gets decent traffic and consistently builds backlinks to the post without any further effort on our part. The specific page has a PA of 46 and DA of 55 with >500 domains linking to it.  This compares to our home page with a PA of 47 and 700 linking domains. It is typically the home page that ranks for our money keywords "HR Software" "HR Systems" in the UK. Because this blog post is so loosely related to our actual business, the traffic it generates is highly unlikely to  turn into a customer of ours. I am considering redirecting the blog post to the home page to pass link juice to the home page. The concern I have is that, based on the anchor text and contextual signals from linking pages, Google might then infer that our home page is less relevant for our money keywords and more relevant for "plants". Are my concerns unfounded? What are your thoughts? Should I redirect the blog post to the home page? Another internal page?  Keep the blog post live? Thanks

                            On-Page Optimization | Jan 11, 2021, 9:46 PM | crichardson1992
                            2
                          • baystatemarketing

                            My site auto redirects http to https. This is causing redirect chains. What can I do?

                            I noticed that Moz flags a lot of redirect chain issues on my site. I realized that this is mostly because the site automatically redirects http to https, and when I create a new URL (when a URL changes, for example) it is automatically flagged as a chain. Example: http://www.example-link Auto directs to: https://www.example-link Which is then redirected to: https://www.example-link-changed (when the address actually changes) I don't seem to have any control over changing where the initial http redirect goes. Any advice on fixing this problem?

                            On-Page Optimization | Dec 28, 2019, 7:05 AM | baystatemarketing
                            0
                          • woodchuckarts

                            How can a page rank for keywords that it does not have on it?

                            I have a client that is ranking in the top 10 for several keywords on their homepage. Their site has no purposeful SEO in it, there is barely any text on the homepage at all and none of the text are the keywords it is ranking for.

                            On-Page Optimization | Sep 10, 2017, 7:18 PM | woodchuckarts
                            2
                          • Unbranded_Lee

                            301 Redirect or landing page

                            Hi everyone. I'm currently doing some SEO for a client, at the moment he has some landing pages which are categorised, but the category is set as a 302 redirect. I have a dilemma whether to 301 redirect to the landing page or make a page for each category. The link structure is as follows - http://examplesite.co.uk/products/fire/company-1/product/ so currently this is set as a 302 redirect - http://examplesite.co.uk/products/fire/company-1/ Do I make this page a category page and link the page to the children with some on-page optimisation or 301 redirect it?

                            On-Page Optimization | Jul 6, 2016, 1:49 PM | Unbranded_Lee
                            0
                          • AfroSEO

                            Multiple menu items pointing to same page

                            I have an automotive dealer as a client. The primary nav has a finance menu item, which (of course) points to the finance related pages. He just requested that I add a finance link item, as child menu items, under the new and used car nav items. Now, this is wrong for a host of reasons, what is the best way to communicate to this to him? I mean, I see this as a usability issue, it's wrong thematically, we would end up having 3 links pointing to the same page. Would this classify as dupe content?

                            On-Page Optimization | Jun 29, 2015, 2:44 PM | AfroSEO
                            0
                          • aronwp

                            What to do with multiple forms and thank you pages

                            Hi Everyone, I'm wondering what to do with form and thank you pages. I asked a question a long time ago about the contact page as noindex and was told by people that its better to leave it and write content for it and thats what we did. Now I have a client that does self storage and they have 4 locations and each location has a reservation page with a basic form but no content. Each page also redirects to a thank you page with tracking codes. There's a total of 6 "thank you" pages with different codes (this was done by yellow book). 4 "reserve your storage pages", 2 pages to pay for storage with iframes to 3rd party payment portals. I was told to noindex these pages but I'm not sure so I'm asking here. I was also told to nofollow and remove them from sitemaps. Thanks Aron

                            On-Page Optimization | Jul 10, 2014, 12:04 AM | aronwp
                            0
                          • 1akal

                            How many Anchor text i can make on One page.

                            I would like to have clear answer in numbers i.e. 1, 2, 3, or 4 etc. of how many Anchor text i can make on One page.????

                            On-Page Optimization | May 12, 2014, 9:39 AM | 1akal
                            0

                          Get started with Moz Pro!

                          Unlock the power of advanced SEO tools and data-driven insights.

                          Start my free trial
                          Products
                          • Moz Pro
                          • Moz Local
                          • Moz API
                          • Moz Data
                          • STAT
                          • Product Updates
                          Moz Solutions
                          • SMB Solutions
                          • Agency Solutions
                          • Enterprise Solutions
                          Free SEO Tools
                          • Domain Authority Checker
                          • Link Explorer
                          • Keyword Explorer
                          • Competitive Research
                          • Brand Authority Checker
                          • Local Citation Checker
                          • MozBar Extension
                          • MozCast
                          Resources
                          • Blog
                          • SEO Learning Center
                          • Help Hub
                          • Beginner's Guide to SEO
                          • How-to Guides
                          • Moz Academy
                          • API Docs
                          About Moz
                          • About
                          • Team
                          • Careers
                          • Contact
                          Why Moz
                          • Case Studies
                          • Testimonials
                          Get Involved
                          • Become an Affiliate
                          • MozCon
                          • Webinars
                          • Practical Marketer Series
                          • MozPod
                          Connect with us

                          Contact the Help team

                          Join our newsletter

                          Access all your tools in one place. Whether you're tracking progress or analyzing data, everything you need is at your fingertips.

                          Moz logo
                          © 2021 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                          • Accessibility
                          • Terms of Use
                          • Privacy

                          Looks like your connection to Moz was lost, please wait while we try to reconnect.