Best Redirect for old .htm extention to root ?
-
I have been trying to figure this out with different redirects but cannot seem to get this correct. Some of our forums link to pages that do not exist or are very old. They have (.htm) extension. I do not want to redirect the .htm to .php because the actual names of the link have changed too. What is the best code to redirect any link that has a .htm extention to the root domain? right now I have this code to redirect index.htm to the root, but that is all it works for. I think.
RewriteCond %{THE_REQUEST} ^.*/index.htm
RewriteRule ^(.*)index.htm$ http://www.example.com$1 [R=301,L]
-
Wordpress and other software either comes designed for SEO, or has plug-ins which offer SEO abilities.
They work by automating some tasks for you. For example, they can automatically canonicalize pages or use friendly URLs. Any SEO options you set up must be thoroughly inspected. While they do make things easier, I would never treat it as a "set it and forget it". Many people get away with that approach, but others do not.
-
Thanks! How do you name a file without an extention then? Is this done with a CMS ? I did not realize that extentions were bad. Do you think if I would redo our website soon using Wordpress or expression engine, do you think this may help our rankings too ?
-
I realize your focus is fixing your .htm issue, but I would like to make one suggestion. Start using friendly URLs which don't show an extension. It should be a win for your site.
-
none of the .htm pages exist. I just noticed a bunch of forums that link to us use the .htm extention. I am assuming these are very old pages. I noticed these links were broken in Google Webmaster Tools. So I want to redirect these old links to our home page. I just want them redirected, because I cant stand seeing these in Google Webmaster Tools. This code redirects every single page on my website now to the root domain.
-
-
Okay... let's try adjusting that slightly:
RedirectMatch 301 ^/(.*).htm$ /
Another option, depending on how many .htm pages you need to redirect, is to place this in your .htaccess file in the directory where your .htm pages are located:
<code>RedirectPermanent /oldpage.htm http://www.example.com/</code>
-
that code actually breaks all my links. Currently all of our links are .php. I just want to redirect old links that have .htm to our home page.
-
when i try that, the website does not load quick. It and when I click on a link it takes forever. But once I remove it, then it is fine.
i tried adding this alone (removing the other code) and i also tried it with the other code.
Any idea why?
-
<code>This should do the trick :)</code>
<code>RedirectMatch 301 (.*).htm$ /</code>
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
-
Glossary Page - best practice
Hi guys, We have a glossary on our website. All terms are accessible via a 'view all' URL, however we also have each letter on their own URL, e.g /a. Currently the rel=canonical tag for all the individual letter pages points to the view all URL. I'm just wondering whether that is best practice or not, as currently not all the individual letter pages are being indexed. Thanks 🙂
Technical SEO | | brian-madden0 -
Redirect old shop to new domain
I have an old Magento shop placed on a subdomain: http://webshop.teamout.dk/ Now I have created a new shop in another store system called ShopOrama on a new rootdomain: What is the best way to get all my already indexed sites from google to redirect to my new site with the new META title + description? I have tried the Magento > Catalog > URL Rewrite, but it contains over 500 redirects already and making custom redirects for all my sites will take a lot of time. Because of the old site being a subdomain I can't change address in GWT. I'm looking forward to your solutions
Technical SEO | | NicolaiTeglskov.dk0 -
Is there a tool to see all redirects?
I'm thinking this is a silly question, but I've never had to deal with it I thought I'd ask. Ok is there a tool out there that will show all the redirects to a domain. I'm working on a project that I keep stumbling on urls that redirect to the site I'm studying. They don't show up in Open Site or ahrefs as linking domains, but they keep popping up on me. Any thoughts?
Technical SEO | | BCutrer0 -
.htaccess Redirect 301 issues
I have completely rewritten my web site, adding structure to the file directories. Subsequently added was Redirect information within the .htaccess file. The following example ...
Technical SEO | | Cyberace
Redirect 301 /armaflex.html http://www.just-insulation.com/002-brands/armaflex.html
Returns this response in the URL bar of ...
http://www.just-insulation.com/002-brands/armaflex.html?file=armaflex
I am at a loss to understand why the suffix "?file=armaflex" is added The following code is inserted at the top of the file ...
RewriteEngine On redirect html pages to the root domain RewriteRule ^index.html$ / [NC,R,L] Force www. prefix in URLs and redirect non-www to www RewriteCond %{http_host} ^just-insulation.com [NC]
RewriteRule ^(.*)$ http://www.just-insulation.com/ [R=301,NC] Any advice would be most welcome.0 -
Domain redirect seo
Hello, my domain www.pacomarca.com and when i start the new campaing i get this pronblem: We have detected that the domain www.pacomarca.com and the domain pacomarca.com both respond to web requests and do not redirect. Having two "twin" domains that both resolve forces them to battle for SERP positions, making your SEO efforts less effective. We suggest redirecting one, then entering the other here. my domain is in networksolutions.com. how can i resolve it? many thanks Gonzalo
Technical SEO | | Kuna0 -
301 Redirect Question
I'm working on a site that has a lot of indexed pages and backlinks to both domain.com and www.domain.com. Will using a 301 redirect to send domain.com to www.domain.com merge all of the indexed pages and links over to www.domain.com, thereby strengthening the www?
Technical SEO | | Yo_Adrian0 -
Redirecting root domains to sub domains
Mozzers: We have a instance where a client is looking to 301 a www.example.com to www.example.com/shop I know of several issues with this but wondered if anyone could chip in with any previous experiences of doing so, and what outcomes positive and negative came out of this. Issues I'm aware of: The root domain URL is the most linked page, a HTTP 301 redirect only passes about 90% of the value. you'll loose 10-15% of your link value of these links. navigational queries (i.e.: the "domain part" of "domain.tld") are less likely to produce google site-links less deep-crawling: google crawls top down - starts with the most linked page, which will most likely be your domain url. as this does not exist you waste this zero level of crawling depth. robots.txt is only allowed on the root of the domain. Your help as always is greatly appreciated. Sean
Technical SEO | | Yozzer0 -
Domain Redirect Issues
Hi, I have a domain that is 10 years old, this is the old domain that used to be the website for the company. The company approximately 7 years ago was bought by another and purchased a new domain that is 7 years old. The company did not do a 301 redirect as they were not aware of the SEO implications. They continued building web applications on the old domain while using the new domain for all marketing and for business partner links. They just put in a server level redirect on the folders themselves to point to the new root. I am on Tomcat, I do not have the option of a 301 redirect as the web applications are all hard coded links (non-relative) (hundreds of thousands of dollars to recode) After beginning SEO; Google is seeing them as the same domain, and has replaced all results in Google with the old domain instead of the new one..... My questions is.... Is it better to take the hit and just put a robots.txt to disallow all robots on the old domain Or... Will that hurt my new domain as well since Google is seeing them as the same? Or.... Has Google already made the switch without a redirect to see these as the same and i should just continue on? (even the cache for the new site shows the old domain address) Old Domain= www.floridahealthcares.com New = www.fhcp.com *****Update after writing this I began changing index.htm to all non relative links so all links on the old domain homepage would point to fhcp.com fixing the issue of the entire site being replicated under the old domain. I think this might "Patch" my issue, but i would still love to get the opinion of others Thanks Shane
Technical SEO | | Jinx146780