Articles & Code Snippets

.htaccess redirect

.htaccess redirect

Your website can be accessed with and Since Google penalizes this due to duplicated content reasons, you have to stick your domain to either or You can fix this easily with .htaccess:

Apache .htaccess redirect

Ex: to redirect all traffic from to

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule (.*)$1 [R=301,L]

To redirect to

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$$1 [R=301,L]

Option 2:

 RewriteCond %{HTTP_HOST} ^ RewriteRule (.*)$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ [R=301,L]


Just feel like saying Hi?

  1 (903) NEGRARU phone