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 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
-
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 -
How long should I leave an existing web page up after a 301 redirect?
I've been reading through a few of blog posts here on moz and can't seem to find the answer to these two questions: How long should I leave an existing page up after a 301 redirect? The page old page is no longer needed but has pretty high page authority. If I take the old page down—the one that I'm redirecting from—immediately after I set up the 301 redirect, will link juice still be passed to the new page? My second question is, right now, on my index.html page I have both a 301 redirect and a rel canonical tag in the head. They were both put in place to redirect and pass link equity respectively. I did this a couple years back after someone recommended that I do both just to be safe, but from what I've gathered reading the articles here on moz is that your supposed to pick one or the other depending on whether or not it's permanent. Should I remove the rel conanical tag or would it be better to just leave it be?
On-Page Optimization | | ScottMcPherson0 -
How to fix Medium Priority Issues by mozpro crawled report??
How to resolve this issues crawled by mozpro?
On-Page Optimization | | renukishor
Some Medium priority issues like that: Missing Meta Description Tag: 2669
Title Element is Too Long: 523
Duplicate Page Title: 37 How to add missing meta description tag in these pages and how to short title element ?0 -
Why Can't I Get Indexed?
I cannot seem to get my website indexed by Google! I submitted the sitemap using Google WMT about a month ago but only one page is being indexed. There are very few backlinks to the site, so I don't believe there are any penalties due to over-optimization that would prevent indexing. Also, my robots.txt file is properly configured and is not preventing any pages from being crawled. I've tried using the "Fetch as Google" settings in WMT with no luck. Any ideas?
On-Page Optimization | | socialfirestarter0 -
Redirect both / and non-/ URLs?
I am doing SEO on WP site. Due to some duplicate pages (rel canonical was done before) I am doing 301 redirects at the moment. And I wonder if I need to redirect both links w/ and w/o trailing slash. Default is non www, w/o trailing slash. Like there is .com/category/news but there is same page linked in .com/news (well it works when permalink structure is set to /%category%/%postname% and returns 404 error when structure is set to /%postname%).
On-Page Optimization | | OVJ
I redirected .lt/naujienos to .lt/category/naujienos. Should I also redirect .lt/naujienos/ (with trailing slash)? There's absolutely no problem redirecting this, but there are some more pages which I want to edit their URLs and I wonder If I should do both redirects from links /w and w/o slash?1 -
301 vs 302 redirect
Hello Mozers, I have a website which offers subscriptions on a monthly basis, when one profile expires the link of the profile gets a 301 redirect to the main category, just that if the member chooses to come back after a while he can reactivate the profile and the link will work again and the 301 will disappear, Should I be doing 302 redirect, as from this point of view it's only a temporarily redirect ? Thanks in advance
On-Page Optimization | | asmedia0 -
How Can I Fix Adobe Bridge Photo Galleries and Duplicate Content?
I have used the Adobe bridge program for a number of photo galleries on a remodeling site and it is showing a large amount of duplicate titles, etc. Is there an easy fix to this? anyone?
On-Page Optimization | | DaveBrown3330 -
Multiple H1's
Hi, My SEOMOZ report states that I'm using two H1's on most of my pages, for example on this page: http://www.absolutepower.nl/eiwitshakes/proteine-shakes/ I only see one though. Anyone who could clarify this? Thanks! Jasper
On-Page Optimization | | Japking0