301 redirect from .html to non .html?
-
Previously our site was using this as our URL structure: www.site.com/page.html. A few months ago we updated our URL structure to this: www.site.com/page & we're not using the .html.
I've read over this guide & don't see anywhere that discusses this: http://www.seomoz.org/learn-seo/redirection.
I've currently got a programmer looking into, but am always a bit weary with their workarounds, as I'd previously had them cause more problems then fix it. Here is the solution he is looking to do:
The way that I am doing the redirect is fine. The problem is of where to put the code. The issue is that the files are .html files that need to be redirected to the same url with out a .html on them. I can see if I can add that to the 404 redirect page if there is one inside of there and see if that does the trick. That way if there is no page that exists without the .html then it will still be a 404 page. However if it is there then it will work as normal. I will see what I can find and get back.
Any help would be greatly appreciated.
Thanks,
BJ
-
Sha,
I wanted to send a quick update & see if we're on the right track? After implementing this 301 redirect, I'm seeing a few negatives, but also a few positives & would appreciate your feedback:
Concerns:
-
Google Organic Traffic has dropped by 26.65% since we implemented the redirect (12 Days).
-
Top Content Pages From Search Traffic has dropped from a weekly average of 1,500 pages to 998. I've segmented the Analytics to see if I had more or less pages that were driving traffic to my site (Organic Only).
Positives:
-
Bing Organic Traffic is up 32.15% although not substantial for our overall traffic, but it has increased.
-
Yahoo Organic Traffic is up 26.53% less traffic than Bing, so not substantial.
-
Webmaster Tools Pages crawled per day: http://screencast.com/t/krkD69bj3mG we've had a huge spike, which I'm assuming is a good thing & a direct correlation to the 301 redirect.
All this being said, are we on the right track? The initial traffic loss had me worried, but after seeing the crawl stats it gave me hope? Do i just need to be more patient to see this through? Are we missing anything, or is this what you would expect?
Thanks,
BJ
-
-
Happy to help
If you strike any issues let me know.
Sha
-
Thanks for all the help Sha! We'll play with the example code that you'd sent & see what we can come up with. After a few weeks I'll continue to watch our organic rankings & see how it affects us overall.
Thanks,
BJ
-
Not having seen the code your programmer intends to use, that is not possible to say definitively. That is why we built the test for you, so that you can see the code.
If you take a look at the code you will see that the Rule is writing 301 redirects if the conditions are met.
A .htaccess file is read from top to bottom. The first condition matched will be the one used.
Basically, you have one set of files on your server, all of which have the extension .html.
When a request is made, you are asking the server to load the .html file in the browser, but rewrite a "pretty URL" for the user to see in the Address Bar.
So, there are three possible scenarios for a request:
- the user requests /page.html (server loads.html and rewrites the URL to /page)
- the user requests /page (server 301 redirects request to /page.html, loads it in the browser and rewrites the URL to /page)
- the user requests a page that does not exist on the server (server 301 redirects the page to /404.html, loads it and rewrites the URL to /404)
Personally, I would not be going out of my way to rewrite simple URL's just to remove the .html extension, but that is your choice, and I am assuming there is more to it and you had some good reason for doing this in the first place.
The one thing you need to be cautious of in making these types of decisions is that chopping and changing from one thing to another and back again is not a great idea. A 301 redirect should really only be used when you are sure that you want to make a permanent change.
Hope that helps,
Sha
-
My fear with this approach is how the search engines will handle the redirect? I know that from the users perspective this should work, but I've never read any articles that even resemble this type of approach.
Do you believe that this method will pass the value along in the search engines & treat it as a proper 301 redirect.
Thanks,
BJ
-
Hi BJ,
From the information you included here it seems your programmer's approach is sound.
We made a demo for you with a working test and example code for the .htaccess so that you can check that it will achieve your aim in any likely scenario.
Take a look at 301 Redirect and URL Rewrite Example
Hope that helps,
Sha
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
-
Is it worth keeping a decades-old domain that's merely 301 redirecting to the main domain?
Hi fellow Moz SEOs, We have a bigger client who we just did an SEO Site Audit for, and it was discovered that they have several domain names that are simply 301 redirecting to their main domain name. One of their domains in particular is decades old, and the client is asking if there is any value in keeping it (and the others), or simply leaving them as-is. Considering the domain age, does anyone have any recommendations? Much appreciated, Zack Barton
Intermediate & Advanced SEO | | Zack
Barton Interactive
(833) 442.6853 // office
(408) 910.7750 // mobile
https://bartoninteractive.com0 -
301 Redirects for Multiple Language Sites in htaccess File
Hi everyone, I have a site on a subdomain that has multiple languages set up at the domain level: https://mysite.site.com, https://mysite.site.fr , https://mysite.site.es , https://mysite.site.de , etc. We are migrating to a new subdomain and I am trying to create 301 redirects within the htaccess file, but I am a bit lost on how to do this as it seems you have to go from a relative url to an absolute - which would be fine if I was only doing this for the english site, but I'm not. It doesn't seem like I can go from absolute url to an absolute url - but I could be wrong. I am new to editing the htaccess file - so I could definitely use some advice here. Thanks.
Intermediate & Advanced SEO | | amberprata0 -
CNAME record for WWW to Non-WWW Vs. 301?
I was just chatting with the person who set up our site on our domain hosting and they said they added in a CNAME record to transfer the www version of my site to the Non-www version. Shouldn't this be set up as a 301 redirect? I have hundreds of links built to the www version and only a few to the non-www version. Or Could I just add in a 301 in addition to the CNAME record? This is not my wheelhouse and need a little advice. Thanks in Advance.
Intermediate & Advanced SEO | | photoseo10 -
Handling Multiple Domain 301 Redirects on Single htaccess file
Hello, I have a client that currently that has 9 different markets with different sub-domains on one server (aka one htaccess file.). All the sites have very similar Navigation and some of them contain the same products aka same URLs. The site is using Magento CMS and I'm trying to figure out how to redirect some products that have been removed from one of the stores. The problem I'm running into is when I try to redirect one store url, it redirects all the site's URLs. Example http://store.domain1.com/ http://store.domain2.com/ I'd like to redirect http://store.domain1.com/old-url.html to http://store.domain1.com/new-url.html without making http://store.domain2.com/old-url.html redirect. I've literally been pulling out my hair trying to figure this one out but have had no luck. Does anybody have any ideas on how I could do this without having the sites redirect or create any loops? Any wisdom from you apache experts would be greatly appreciated. Thanks, Erik
Intermediate & Advanced SEO | | Erik-M0 -
Php 301 redirect
Hi I am migrating an old wordpress site to a custom PHP site and the URL profiles will be different, so want to retain all link profiles and more importantly if a user visits the old urls via search then they are seamlessly transferred to the new equivalent page For example www.domain.com/about-us is going to need to redirect to www.domain.com/aboutus.php www.domain.com/furniture is going to need to redirect to www.domain.com/furniture-collections.php etc What is the best way of achieving this apart from .htaccess as not 100% confident of doing this. Could it be done via PHP or using meta tags?
Intermediate & Advanced SEO | | ocelot0 -
Is it safe to 301 redirect old domain to new domain after a manual unnatural links penalty?
I have recently taken on a client that has been manually penalised for spammy link building by two previous SEOs. Having just read this excellent discussion, http://www.seomoz.org/blog/lifting-a-manual-penalty-given-by-google-personal-experience I am weighing up the odds of whether it's better to cut losses and recommend moving domains. I had thought under these circumstances it was important not to 301 the old domain to the new domain but the author (Lewis Sellers) comments on 3/4/13 that he is aware of forwards having been implemented without transferring the penalty to the new domain. http://www.seomoz.org/blog/lifting-a-manual-penalty-given-by-google-personal-experience#jtc216689 Is it safe to 301? What's the latest thinking?
Intermediate & Advanced SEO | | Ewan.Kennedy0 -
Multiple 301 Redirects on the same domain name
Hi, I'd appreciate some advice ont he below. I have a website, say www.site.co.uk that has just been redesigned using a new CMS. Previously it had URLs in the format /article.php?id=123, the new site has more friendly urls in the format /articles/article-slug. I have been able to import the old articles into my CMS using the same article IDs and I have created a unique slug for each post. So now in my database, I have the article id (from the querystring) and a slug. However, I have hundreds of old URLs indexed by Google in the format /article.php?id=123 and need to redirect these. My plan was to do the following. 301 Redirect /article.php?id=123 to an intermediate page, in this case /redirect/123. On this intermediate page I would do a database lookup for the article slug, based on the ID from the querystring, create a new URL and perform a second 301 redirect to my new URL E.g. /articles/article-slug-from-database. Whilst this works and keeps the site usable for visitors the two 301 redirects do worry me, as I don;t want Google indexing lots of /redirect/[article id] urls. The other solution is to generate hundreds of htaccess redirect rules that map old url to the new url. The first solution is much cleaner, but the two 301's worry me. Will Google work this out on it's own, is there a better way? Any advice is much appreciated. Cheers Rob
Intermediate & Advanced SEO | | AmyCrompton1 -
Redirect non www. domain to WWW. domain for established website?
Hey guys, The website in question has been online for more than 5 years but there are still 2 versions of the website. Both versions are indexed by Google and of course, this will result in duplicate content. Is it necessary to redirect the non-www domain to the www. domain. What are the cons and advantages? Will a lot of organic traffic be lost at first (if non-www are getting a good amount of traffic)? Thanks.
Intermediate & Advanced SEO | | BruLee0