I've been trying everything to manage a redirect from www.domain.com to domain.com, but nothing seems to work for me. I always get a redirect loop - and I've tried various things I found here or on Google.
So here is my .htaccess, maybe someone could help me figure out what I can do to redirect correctly or if there is something wrong in here.
# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php
#####################################################################
# Don't show directory listings for URLs which map to a directory.
# For security reasons, Option all cannot be overridden.
# Options -Indexes
#####################################################################
Options ExecCGI Includes IncludesNOEXEC IncludesNOEXEC MultiViews SymLinksIfOwnerMatch Indexes -Indexes
# Set the default handler
DirectoryIndex index.php
#####################################################################
#
# REWRITES
#
#####################################################################
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
# Redirect all to .php
# Example: example.com/hello -> example.com/hello.php
RewriteRule ^(.*)$ $1.php [L,R=301]
# show example.com/index.php always as example.com/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://example.com/ [R=301,L]
<IfModule mod_expires.c>
<FilesMatch "\.(gif|jpg|jpeg|png|flv|swf|css|js|html?|xml|txt|ico)$">
ExpiresActive On
ExpiresDefault "access plus 10 years"
</FilesMatch>
</IfModule>
<FilesMatch "\.(gif|jpg|jpeg|png|flv|swf|css|js|html?|xml|txt|ico)$">
FileETag none
</FilesMatch>
<FilesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>
#####################################################################
#
# REDIRECTS (301)
#
#####################################################################
Redirect 301 /en/ /
Redirect 301 /en/index.php /
Redirect 301 /en/search.php /
# ... and so on
Thank you so much! I've already spent so much time trying to figure this out.