Moz Q&A is closed.
After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.
Correct .htaccess settings for canonical url?
-
I want to forward all urls to http:www.mysite.com but am a little confuse because I am getting duplicate content error:
Pages with Duplicate Page Content
as of Jan 15http://titanappliancerepair.com/ 1 duplicatehttp://titanappliancerepair.com 1 duplicatehttp://titanappliancerepair.com/index.html 1 duplicate*****************************************************************What should I put ion htaccess file so I can forwardhttp://titanappliancerepair.com/index.htmlhttp://titanappliancerepair.comhttp://titanappliancerepair.com/to http://www.titanappliancerepair.comor what is the correct way to do it?I'm confused because when I enter http://titanappliancerepair.com/ in browser it showshttp://titanappliancerepair.com so how can it be considered duplicate content?.Can someone help?I have godaddy and they have gave me this code to put RewriteEngine on
rewritecond %{http_host} ^coolexample.com [nc]
rewriterule ^(.)$ http://www.coolexample.com/$1 [r=301,nc]What is correct? -
your directories have duplication. For example: http://www.titanappliancerepair.com/about-us.html and http://www.titanappliancerepair.com/about-us
You may also need RewriteRule ^(.*).html$ /$1 [R=301**,**L]
-
Ok I have added this to htaccess file and everything seems to be redirecting in browser ok but is it good enough for google?
Can someone check and tell me if it is correct , if not can you help with code? Thanks in advance!
RewriteEngine on
rewritecond %{http_host} ^titanappliancerepair.com [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
rewritecond %{http_host} ^titanappliancerepair.com/ [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
rewritecond %{http_host} ^titanappliancerepair.com/index.html [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
RewriteBase /redirect html pages to the root domain
rewriterule ^index.html$ / [r=301,nc]
-
It looks like you are redirecting any URL back to itself.
You want something like this which will remove index.html and enforce a trailing slash-
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]
-
This is what I have so far in htaccess file
RewriteEngine on
rewritecond %{http_host} ^titanappliancerepair.com [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
rewritecond %{http_host} ^coolexample.com/ [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
rewritecond %{http_host} ^coolexample.com/index.html [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
rewritecond %{http_host} ^www.titanappliancerepair.com/index.html [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]
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
-
Canonical: Same content but different countries
I'm building a website that has content made for specific countries. The url format is: MyWebsite.com/<country name="">/</country> Some of the pages for <specific url="">are the same for different countries, the <specific url="">would be the same as well. The only difference would be the <country name="">.</country></specific></specific> How do I deal with canonical issues to avoid Google thinking I'm presenting the same content?
On-Page Optimization | | newbyguy0 -
Meta title not showing up correctly on SERP
We have an issue with some clients on a Wordpress CMS where title tags implemented on a Yoast SEO plugin for the Homepage are not coming up as we'd implemented them. However, the source code shows we'd implemented them correctly according to what we'd wanted.**For example, this is the title tag we implemented in the CMS:Towing Services Alberta | Jack's TowingSource code shows:Towing Services Alberta | Jack's TowingHowever, SERP results shows:**Jack's Towing | Towing Services Alberta This is not an issue with the rest of the other pages and there isn't a global template for our client's sites. It's perplexing that it's only happening on the Homepage and this is across for 3 of our clients' sites.Even more perplexing, recently we've noticed that SERP is only showing the client's business name as the title tag and this is across for 2 out of the 3 clients we'd mentioned above. Nothing has changed in the back-end.Would appreciate some insight on this issue!
On-Page Optimization | | Gavo4 -
City Name in URL structure
I have a client whose site was built when they only served one market, and they now have that city in the majority of their URLs. I'm suggesting we redo the URL structure to remove this location from the main URLs (think homepage, about, etc.) since they have now expanded to three markets. They are seeing a lot of great organic traffic in that original market but are struggling in the new ones they've added so I'm helping to optimize their site. How critical do you think that removing that location from the URL is? I know we would need to implement 301 redirects, but wanted to get thoughts on this.
On-Page Optimization | | maghanlinchpinsales0 -
Home page keyword in url
I have been looking into SEO for a few weeks now trying to perfect a homepage. Going through various sources on MOZ, and other examples out there on the internet, I keep seeing that you should have your keyword in the URL of the page. The homepage is the page most people want to rank the highest in google searches, however, you cannot put the keyword in the URL as most home page URLs are simply /. Should I actually make the home like this: www.example.com/key-word-example? I would imagine this would not be the normal for many users and would seem like it's not the home page.
On-Page Optimization | | Matthew_smart0 -
Ecommerce URLs with numbers
Hi everybody! I have to optimize an ecommerce where somebody has previously done the SEO optimization, although the URLs have numbers before the product's name They have told me that these numbers are useful to find the products, so I think it shouldn't be really bad if I don't redirect them to "clear" ones. For example: /colesterol-sobrepeso/2217-hc-grass-capsulas-duras-15-capsulas.html > /colesterol-sobrepeso/hc-grass-capsulas-duras-15-capsulas.html Am I right? After all, they contain the keywords and the subfolders are also ok. Or it would be better if I redirect the whole site? Thanks!
On-Page Optimization | | Estherpuntu0 -
How important are clean URLs?
Just wanting to understand the importance of clean URLs in regards to SEO effectiveness. Currently, we have URLs for a site that reads as follows: http://www.interhampers.com.au/c/90/Corporate Gift Hampers Should we look into modifying this so that the URL does not have % or figures?
On-Page Optimization | | Gavo1 -
Does Rel=canonical affect google shopping feed?
I have a client who gets a good portion of their sales (~40%) from Google Product Feeds, and for those they want each (Product X Quantity) to have it’s own SKU, as they often get 3 listings in a given Google shopping query, i.e. 2,4,8 units of a given product. However, we are worried about this creating duplicate content on the search side. Do you know if we could rel=canonical on the site without messing with their google shopping results? The crux of the issue is that they want the products to appear distinct for the product feed, and unified for the web so as not to dilute. Thoughts?
On-Page Optimization | | VISISEEKINC0 -
How to Structure URL's for Multiple Locations
We are currently undergoing a site redesign and are trying to figure out the best way to structure the URL's and breadcrumbs for our many locations. We currently have 60 locations nationwide and our URL structure is as follows: www.mydomain.com/locations/{location} Where {location} is the specific street the location is on or the neighborhood the location is in. (i.e. www.mydomain.com/locations/waterford-lakes) The issue is, {location} is usually too specific and is not a broad enough keyword. The location "Waterford-Lakes" is in Orlando and "Orlando" is the important keyword, not " Waterford Lakes". To address this, we want to introduce state and city pages. Each state and city page would link to each location within that state or city (i.e. an Orlando page with links to "Waterford Lakes", "Lake Nona", "South Orlando", etc.). The question is how to structure this. Option 1 Use the our existing URL and breadcrumb structure (www.mydomain.com/locations/{location}) and add state and city pages outside the URL path: www.mydomain.com/{area} www.mydomain.com/{state} Option 2 Build the city and state pages into the URL and breadcrumb path: www.mydomain.com/locations/{state}/{area}/{location} (i.e www.mydomain.com/locations/fl/orlando/waterford-lakes) Any insight is much appreciated. Thanks!
On-Page Optimization | | uBreakiFix0