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
- 
					
					
					
					
 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/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. 
- 
					
					
					
					
 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 
- 
					
					
					
					
 Hi Tai, were you able to implement Matt's suggestions? 
- 
					
					
					
					
 Hi Tai! Any update on this issue? Please let us know so we can help! Thanks. Christy 
- 
					
					
					
					
 Hi Matt, sorry for the delay in getting back. Just working on your suggestions, I will let you know if it works T 
- 
					
					
					
					
 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 
- 
					
					
					
					
 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 
- 
					
					
					
					
 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]
- 
					
					
					
					
 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 
- 
					
					
					
					
 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 
- 
					
					
					
					
 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 
- 
					
					
					
					
 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. 
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 ToolsChat with the community about the Moz tools. 
- 
		
		SEO TacticsDiscuss the SEO process with fellow marketers 
- 
		
		CommunityDiscuss industry events, jobs, and news! 
- 
		
		Digital MarketingChat about tactics outside of SEO 
- 
		
		Research & TrendsDive into research and trends in the search industry. 
- 
		
		SupportConnect on product support and feature requests. 
Related Questions
- 
		
		
		
		
		
		How To Avoid Redirect Chains When Switching From http to https
 I have been working on on-page SEO which has involved switching from http to https, and renaming URLs. I am running in to issues with redirect chains. Here is a scenario: Old URL: http://bwisecontractors.ca/products/decks-and-deck-covers/ New URL: https://bwisecontractors.ca/renos-additions/sunrooms-patio-covers/ Since I already created the redirect addressing the redirecting from http to https for the root domain: (http://bwisecontractors.ca to https://bwisecontractors.ca), should the redirect for the above be http://bwisecontractors.ca/products/decks-and-deck-covers/ to https://bwisecontractors.ca/renos-additions/sunrooms-patio-covers/ , or should it be http://bwisecontractors.ca/products/decks-and-deck-covers/ to http://bwisecontractors.ca/renos-additions/sunrooms-patio-covers/ (and the root domain redirect will take care of going from http to https) On-Page Optimization | | BWiseContractors0
- 
		
		
		
		
		
		Link flow for multiple links to same URL
 Hi there, On-Page Optimization | | doctecs
 my question is as follows: How does Google handle link flow if two links in a given page point to the same URL? (do they flow link individually or not?) This seems to be a newbie question, but actually it seems that there is little evidence and even also little consensus in the SEO community about this detail. Answers should include source Information about the current state of art at Google is preferable The question is not about anchor text, general best practises for linking, "PageRank is dead" etc. We do know that the "historical" PageRank was implemented (a long time ago) without special handling for multiple links, as e.g. last stated by Matt Cutts in this video: http://searchengineland.com/googles-matt-cutts-one-page-two-links-page-counted-first-link-192718 On the other hand, many people from the SEO community say that only the first link counts. But so far I could not find any data to back this up, which is quite surprising.0
- 
		
		
		
		
		
		Can lazy loading of images affect indexing?
 I am trying to diagnose a massive drop in Google rankings for my website and noticed that the date of the ranking and traffic drop coincides with Google suddenly only indexing about 10% of my images, whereas previously it was indexing about 95% of them. Wondering if addition of lazy load script to images (so they don't load from the server until visible in the browser) could cause this index blocking? On-Page Optimization | | Gavin.Atkinson1
- 
		
		
		
		
		
		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 | | AfroSEO0
- 
		
		
		
		
		
		Multiple Organization Schema on the same site
 I creating a preferred supplier list on my site and wanted to use the Organization Schema for the company details. Is there a issue with having more than one org schema on the same site? or should I just use the one for my company. Thanks in advance On-Page Optimization | | gregdicksonuk1
- 
		
		
		
		
		
		Image titles and alt tags for multiple images
 I'm hoping some of you may be able to help me understand the best way to optimize my image titles and alt tags for a specific situation. I'm working on an interior design website and they have hundreds of pictures. each of their projects has about 10 pictures. Is it best for me to us the key phrase in each title and tag? or is that to repetitive? here is what I mean: A project called "urban interior design" all images are of urban interior design, just different angles and features, so my initial idea is to just have each image title like this: Title: "urban interior design dinning area" Alt: "urban interior design dinning area view" Title: "urban interior design living room" Alt:"urban interior design living room couch view" Is this the best way or will it actually hurt my ranking with too much exact keyword use? Thanks for your help! On-Page Optimization | | TBSEO0
- 
		
		
		
		
		
		How much juice do you lose in a 301 redirect?
 Our site has a number of, shall we say, unoptimized URLs. I would like to change the URLs to be more relevant; if a page is about red widgets, the URL should be www.domain.com/red-widgets.html, right? I'm getting resistance on this, however, based on the belief that you lose something significant when you 301 an old URL to a new one. Now, I know that if you have a long chain of redirects, the spiders will stop following at some point, and that is a huge problem. That wouldn't apply if there's only one step in the chain, however. I've also heard that you lose some link juice in a 301, but I'm unsure how serious that problem actually is. Is it small enough that we'd win out in the long run with better-optimized URLs? On-Page Optimization | | CMC-SD0
- 
		
		
		
		
		
		Schema: Multiple Locations on a Single Page
 Can adding multiple locations on a single page be confusing to Google? Is using "LocalBusiness" with "branchof" the proper way of doing this? Does anyone know of any resources that go into this type of thing in more detail? I've read everything Google, Schema and SeoMoz seem to have on this topic. Thanks. On-Page Optimization | | Kwilder0
 
			
		 
			
		 
			
		 
					
				 
					
				 
					
				 
					
				 
					
				 
					
				 
					
				