301 Redirect from .html
-
Hi there,
Following on from this post:
http://moz.com/community/q/help-with-duplicated-contentPlease could one confirm that using the following code in our htaccess file will stop the duplicated content issue we are having.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+.)+html?\ HTTP
RewriteRule (.+).html?$ http://www.bereavementstationery.co.uk/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.htmlKind Regards
Alec
-
If I understood correctly you changed all your urls from ending with .html to ending with /
Please confirm you previously had the following urls:
http://www.domain.com/somepage.htmland now you have:
http://www.domain.com/somepage.htmlIf the above is correct the code I use to do the redirects is:
RewriteEngine On
RewriteRule (.+).html$ /$1/ [L,R]
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
-
How to fix duplicate content for homepage and index.html
Hello, I know this probably gets asked quite a lot but I haven't found a recent post about this in 2018 on Moz Q&A, so I thought I would check in and see what the best route/solution for this issue might be. I'm always really worried about making any (potentially bad/wrong) changes to the site, as it's my livelihood, so I'm hoping someone can point me in the right direction. Moz, SEMRush and several other SEO tools are all reporting that I have duplicate content for my homepage and index.html (same identical page). According to Moz, my homepage (without index.html) has PA 29 and index.html has PA 15. They are both showing Status 200. I read that you can either do a 301 redirect or add rel=canonical I currently have a 301 setup for my http to https page and don't have any rel=canonical added to the site/page. What is the best and safest way to get rid of duplicate content and merge the my non index and index.html homepages together these days? I read that both 301 and canonical pass on link juice but I don't know what the best route for me is given what I said above. Thank you for reading, any input is greatly appreciated!
On-Page Optimization | | dreservices0 -
How can I redirect anything after the article url to main article?
Hello everyone, When someone visits my websites article like http://www.website.com/article-title/lol , it give to 404 page error. But when someone http://www.website.com/article-title/ , it shows the article. The word "lol" can be changed to anything. I would like that to be redirected to the main article. Example: Someone visits website.com/article-title/lol, they should be redirected to website.com/article-title/ Is it possible to do so? If yes, please tell me how. Note: I'm using WordPress Thank you
On-Page Optimization | | hakhan2011 -
Redirect www.domain to domain
How do I redirect www.entrepreneurhandbook.co.uk to entrepreneurhandbook.co.uk The latter is an existing site. Thanks James
On-Page Optimization | | entrepreneurhandbook1 -
How to do this 301 redirection
Hi there! I have two domains with the same content. Some guys in this forum posted that It would be convinient to do a 301 redirect from one ".com" domain to ".es" domain (my potential market). I just tried to set it up in the htaccess file but it dind't worked at all. Something like: redirect 301 http://wwww.domain.com http://www.domain.es I just configure in the webmaster tools the domain www.domain.com as preferred domain insted of http://domain.comThe same with the other domain. Any help? many thanks
On-Page Optimization | | juanmiguelcr0 -
Redoing a site - 404 redirect or 301 redirect
I'm redoing a website, should i 404 the old pages, or 301 redirect to the main page? what is better? (around 100 pages)
On-Page Optimization | | mkmedia0 -
Page Analysis on our asp.net site is showing the following for HTML Text - //
paintball-online.com This is consistent on every page, despite these pages having text. I assume the SEOMoz tool is working just fine and we have a coding issue that may be hindering our SEO efforts. Any ideas/suggestions? Thanks
On-Page Optimization | | Istoresinc0 -
301 Re-directing a page
Hi, My website is appearing on page 1 of Google for a specific keyword, however when clicking on the search result, the page is out of date. As a short term solution, I have 301 redirected the url to a more up to date page on my website and beginning to optimise the on page content of this new page Is there any recommendations on what to do with the old page that appears on page 1 Google - as the page title, meta description and url displayed is out of date? Any help, best practise would be great...
On-Page Optimization | | simonsw0 -
301 redirect (www.domain.com/index to www.domain.com)
Hello, Please let me know what are the exact right steps in order to get rid of the duplicate content issues related with: www.domain.com/index.html same as www.domain.com without creating an infinite loop. Do you have a step by step guide posted within seomoz including 301 redirect for non www to www for all urls and index.whatever to main domain name without going into a infinite loop ? btw how to you spot the loop ? is it obvious like never ending refresh of the home page ? thanks a lot !
On-Page Optimization | | eyepaq2