.htaccess question/opinion/advice needed
-
Hello,
I am trying to achieve 3 different things on my .htaccess I just want to make sure I am doing it the right or best way because I don't have much experience working on this kind of files.
I am trying to:
a) Redirect www.mysite.com/index.html to www.mysite.com so I don't get a duplicate content/tag error.
b) Redirect mysite.com to www.mysite.com
c) Get rid of the file extensions; www.mysite.com/stuff.html to www.mysite.com/stuff
This is the code that I'm currently using and it seems to work fine, however I would like someone with experience to take a look so I can avoid internal server errors and other kinds of issues. I grabbed each piece of code from different posts and tutorials.
Options +FollowSymlinks
RewriteEngine onIndex Rewrite RewriteRule ^index.(htm|html|php) http://www.mysite.com/ [R=301,L] RewriteRule ^(.*)/index.(htm|html|php) http://www.mysite.com/$1/ [R=301,L]
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.htmlOptions +FollowSymlinks
RewriteEngine on
Rewritecond %{http_host} ^mysite.com [nc]
Rewriterule ^(.*)$ http://www.mysite.com/$1 [r=301,nc]Thanks a lot!
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
-
Redirect wordpress from /%post_id%/%postname%/ to /blog/%postname%/
Hi what is the code to redirect wordpress blog from site.com/%post_id%/%postname%/ to site.com/blog/%postname%/ We are moving the site to a new server and new url structure. Thanks in advance
Intermediate & Advanced SEO | | Taiger0 -
Portfolio Image Landing Page Question/Issue
Hello, We have a client with a very image heavy website. They have Portfolio pages with a large number of images. We are currently working on adding more copy to the site but wanted to confirm we are taking the right approach for the images on the site. Under the current structure each image has its own landing page (with no copy) and is fed in (or generated on) to a Portfolio Page. While we know this is not ideal as it would be best to have the images on the Portfolio Page directly or even fill out the landing pages with copy; due to the amount of images and the fact these are only images (and not a 'targeted' page) that would not really be feasible. Aside from the thin content concern these individual landing pages were being indexed so they are showing hundreds of pages on their sitemap.xml and in GSC even though they only have a few actual pages. In the meantime we went into each image-page and placed a canonical tag back to the main Portfolio Page (with the hopes to add content to that page and have it as the ‘overarching’ page). Would this be the right approach? – We considered ‘noindex-follow’ tags but would want the images to be crawled; the issue is because the pages are not on the actual page are we canonicalizing these images to nothing? Any insight would really be appreciated. Thank you in advance.
Intermediate & Advanced SEO | | Ben-R0 -
Canonical questions
Hi, We are working on a site that sells lots of variations of a certain type of product. (Car accessories) So lets say there are 5 products but each product will need a page for each car model so we will potentially have a lot of variations/pages. As there are a lot of car models, these pages will have pretty much the same content, apart from the heading and model details. So the structure will be something like this; Product 1 (landing page) Audi (model selection page)
Intermediate & Advanced SEO | | davidmaxwell
---Audi A1 (Model detail page)
---Audi A2 (Model detail page)
---Audi A3 (Model detail page) BMW (model selection page)
---BMW 1 Series (Model detail page)
---BMW 3 Series (Model detail page) Product 2 (landing page) Audi (model selection page)
---Audi A1 (Model detail page)
---Audi A2 (Model detail page)
---Audi A3 (Model detail page) BMW (model selection page)
etc
etc The structure is like this as we will be targeting each landing page for AdWords campaigns. As all of these pages could look very similar to search engines, will simply setting up each with a canonical be enough? Is there anything else we should do to ensure Google doesn't penalise for duplicate page content? Any thoughts or suggestions most welcome.
Thanks!0 -
SEO Advice for Angular JS
We are changing our homepage (and gradually the rest of the site) to Angular JS.
Intermediate & Advanced SEO | | theLotter
In order not to lose anything in terms of SEO we are implementing Hashbangs + escaped fragment snapshots. Are there any other SEO considerations you think we should have and/or additional elements that we could add to the page to improve it in terms of SEO?0 -
Paging Question: Rel Next or Canonical?
Hi, Lets say you have a category which displays a list of 20 products and pagination of up to 10 pages. The root page has some content but when you click through the paging the content is removed leaving only the list of products. Would it be best to apply a canonical tag on the paging back to the root or apply the prev/next tags. I understand prev/next is good for say a 3 part article where each page holds unique content but how do you handle the above situation? Thanks
Intermediate & Advanced SEO | | Bondara0 -
Duplicate Content - Panda Question
Question: Will duplicate informational content at the bottom of indexed pages violate the panda update? **Total Page Ratio: ** 1/50 of total pages will have duplicate content at the bottom off the page. For example...on 20 pages in 50 different instances there would be common information on the bottom of a page. (On a total of 1000 pages). Basically I just wanted to add informational data to help clients get a broader perspective on making a decision regarding "specific and unique" information that will be at the top of the page. Content ratio per page? : What percentage of duplicate content is allowed per page before you are dinged or penalized. Thank you, Utah Tiger
Intermediate & Advanced SEO | | Boodreaux0 -
HT.Access Redirect Question
Quick question on the HT.Access / Redirects... II have a site http://www.securitysystemsfortlauderdale.org/ADT-Home-Security-Alarm-Systems/ and I am running througth SEO moz for backlinks and noticed a large descrepancy on the links on the root vs the redirect. There are more links on the root and less on the redirect. Does this affect SEO for Google or does Google follow the redirects and give credit accordingly. Thanks for your help!!! Matt
Intermediate & Advanced SEO | | joeups0 -
Need advice re: selecting an Ecommerce platform
Hi. I am responsible for choosing an ecommerce platform and overseeing the implementation of a large ecommerce site. The site will have tens of thousands of products and will be fairly complex. Eventually the site will integrate with the suppliers back end inventory/order management system, which is some sort of custom Windows/.NET system. (I'm not very technical if you haven't noticed....) Primarily I want a platform that is SEO friendly, and I have to be sure that the site is developed properly from an SEO and usability perspective. I thought I would go with an asp.net solution (aspdotnetstorefront, specifically) to facilitate the future integration, but I am questioning this choice after reading some of the comments I have found here at SEOMoz. So is asp.net really a bad choice SEO-wise? I almost considered Magento, but was having trouble finding a good solution provider to work with. I also worried about integration issues down the road. I would appreciate any advice or input anyone may have. Thank you!
Intermediate & Advanced SEO | | sbg7810