Click on the banner to learn about and purchase my database training on Azure

Avoiding Duplicate Content on Apache Web Server Using .htaccess

Views: 255 views
Reading Time: <1 minutes

In this post I will demonstrate how to avoid one of the major SEO problems, which is duplicate content, that is, two or more URLs on your website have the same content. For SEO, this is terrible, because clicks and views are counted separately according to the way your URL is written. Although it seems just a detail, duplicate content is one of the biggest bad guys with bad rankings in search engines and content aggregators.

As a prerequisite for implementing .htaccess code, your Apache server must already have the mod_rewrite module enabled.

Through the codes I will show you below, we can get around this quickly and practically. It comes down to 3 types of redirects that will be performed by Apache:

  • Enter www in URL if you don't have: Causes and to represent the same URL. When entering the address without WWW Apache will redirect to the URL with WWW automatically.
  • Remove / at end of link: Causes the “/” character to be removed at the end of the URL's, causing to be directed to
  • Remove index.php: Performs the link redirection to, avoiding content redundancy on the main page of your site