What is the difference between the two rewrite rules in htaccess?
-
Force www. prefix in URLs and redirect non-www to www
RewriteCond %{HTTP_HOST} !^www.domain.com.ph
RewriteRule (.*) http://www.domain.com.ph/$1 [R=301,L]Force www. prefix in URLs and redirect non-www to www - 2nd option
RewriteCond %{HTTP_HOST} ^domain.com.ph [NC]
RewriteRule (.*) http://www.domain.com.ph/$1 [R=301,L] -
Thanks Peter!
-
Yes, the result is identical.
Peter
-
So in theory they are identical?
Just different ways of achieving the same result
-
Hi, as mentioned in the other answer I gave here: http://moz.com/community/q/where-is-the-rule-here-that-force-www-in-urls#reply_202351
the first checks for non-inclusion of the www in the URL (the !^www checks if www is not included at the start of the URL being tested), the second checks for a URL that starts with just the domain.
Peter
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
-
Duplicate content warning: Same page but different urls???
Hi guys i have a friend of mine who has a site i noticed once tested with moz that there are 80 duplicate content warnings, for instance Page 1 is http://yourdigitalfile.com/signing-documents.html the warning page is http://www.yourdigitalfile.com/signing-documents.html another example Page 1 http://www.yourdigitalfile.com/ same second page http://yourdigitalfile.com i noticed that the whole website is like the nealry every page has another version in a different url?, any ideas why they dev would do this, also the pages that have received the warnings are not redirected to the newer pages you can go to either one??? thanks very much
White Hat / Black Hat SEO | | ydf0 -
Different site behind the flag
Hello, I am in a very complicated situation. I have a site in Itaian which is targeted in Italy by webmaster tools so the majority of the organic traffic comes from there and everything is fine. However this site got a link from a major international site. So now I get traffic from all over the world but I can't take advantage of it. From the Italian traffic I get from this site I see high pageviews numbers and many minutes in average visitor time. The problem in this situation is that for many reasons this website cannot be translated so I can put many language choices in this site. I want to ask, If I put, let's say an English flag in top of my site, that will indicate the English language, but instead of the user to see an English version of the site he/she will be redirected(no follow link) to another site of the same content in English, will this violate any of Google's guideline or hurt the seo of the original site? Thank you all!
White Hat / Black Hat SEO | | Tz_Seo0 -
NoFollow Rules, Inconsistent?
I'm a bit confused on what the actual "rules" are when it comes to including dofollow backlinks from widgets. When sites like YouTube offer embed codes, don't those include dofollow backlinks in them? And when sites like Facebook offer widgets, don't those too include dofollow backlinks in them? Back in December we released a WordPress plugin, seen here. A few weeks later we saw our rankings plummet. We were told by our SEO consultant that because our link profile changed so drastically over the course of a few weeks, that Google took that as unnatural link building. I have two thoughts on this. First, our plugin is directly related to our site. And it's taking content from our site. Therefore, if another publisher chooses to use our content, does that not mean that they are indeed endorsing our site, and therefore the backlink should be dofollow? Second, what is the difference between a dofollow in our WP plugin, and a dofollow in Facebook's widget? Why does one get you penalized while the other boosts your authority?
White Hat / Black Hat SEO | | JABacchetta0 -
Using a geolocation service to serve different banners in homepage. Dangers? Best Practices?
Hello, our website is used by customer in more than 100 countries. Becasuse the countries we serve are so many, we are using one single domain and homepage, without country specific content. Now, we are considering to use an geolocation service to identify the customer location and then to change the contents of one banner in the home page accordingly. Might this be dangerous from a SEO perspective? If yes, any suggesiton on how can we implement this to avoid troubles and penalties form the Search Engines? Thanks in advance for any help,Dario
White Hat / Black Hat SEO | | Darioz0 -
Competitor owns two domains which are essentially duplicates. Is this allowed?
Hello everyone,One of my competitors has two E-commerce sites that are almost exactly the same. The company re-branded a few years ago (changed the company name, changed the domain name) but kept the first domain live which is still fairly successful. Their re-branded website is a Top 1000 retailer.The thing is, both websites are essentially the EXACT SAME. They have the same products (with the same item #'s), the same pricing, the same copy and product descriptions, the same contact info, same layout, etc. The internal search bar on the first domain even redirects to their current site! The only real difference are the brand names. Currently, both sites are ranking very well for some very competitive keywords. For the past two years, I kept waiting for Google to penalize one (or both) of them for duplication. But for some reason Google seems to have not noticed. **Is there any way to "show google" site duplication they might be missing?**Thanks!
White Hat / Black Hat SEO | | bpharris90141 -
Cross-Site Links with different Country Code Domains
I have a question with the penguin update. I know they are really cracking down on "spam" links. I know that they are wanting you to shift from linking keywords to the brand name, unless it makes sense in a sentence. We have five sites for one company in the header they have little flag images, that link to different country domains. These domains all have relatively the same domain name besides the country code. My question is, linking these sites back and fourth to each other in this way, does it hurt you in penguin? I know they are wanting you to push your identity but does this cross-site scheme hurt you? In the header of these sites we have something like this. I am assuming the best strategy would probably be to treat them like separate entities. Or, just focus on one domain. They also have some sites that have links in the footer but they are set up like:
White Hat / Black Hat SEO | | AlliedComputer
For product visit Domain.com Should nofollows be added on these footer links as well? I am not sure if penguin finds them spammy too.0 -
Multiple domains different content same keywords
what would you advice on my case: It is bad for google if i have the four domains. I dont link between them as i dont want no association, or loss in rakings in branded page. Is bad if i link between them or the non branded to them branded domain. Is bad if i have all on my webmaster tools, i just have the branded My google page is all about the new non penalized domain. altough google gave a unique domain +propdental to the one that he manually penalized. (doesn't make sense) So. What are the thinks that i should not do with my domain to follow and respect google guidelines. As i want a white hat and do not do something that is wrong without knowledge
White Hat / Black Hat SEO | | maestrosonrisas0 -
Webiste Ranking Differently Based on IP/Data Center
I have a site which I thought was ranking well, however that doesn't seem to be the case. When I check the site from different IPs within the US it shows that the site is on page 1 and on other IPs it shows that it's on page 5 and for some keywords it shows it's not listed. This site was ranking well, before but I think google dropped it when I was giving putting in too much work with it (articles and press releases), but now it seems to have recovered when I check with my IP, but on other data centers it still shows it prior to recovering. It was able to recover after not building links to for a period of time, it showed it moved back up from the data center I'm connected to, but it still shows the possibly penalized results on other data centers. Is it possible that site is still penalized? So the question is why does it show it recovered in some data centers and not others? How do I fix this? It's been about 2 months since it's recovered from some data centers. Is this site still penalized or what's going on? There are no warnings in web master tools. Any insights would be appreciated! This isn't an issue with the rank tracking software, I've tested this on a multitude of IPs with varying differences. Thanks!
White Hat / Black Hat SEO | | seomozzy0