Porblem with remove trailing slash and non-www to www - using .htaccess
        Posted  
        
            by 
                HoanNguyen
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by HoanNguyen
        
        
        
        Published on 2012-12-01T06:12:46Z
        Indexed on 
            2012/12/13
            17:03 UTC
        
        
        Read the original article
        Hit count: 408
        
I'm facing an issue with .htacess when combining 2 mod_rewrite at the same time:
- remove trailing slash
 - redirect non-www to www
 
Here is my .htaccess file
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteRule ^(.+)/$ http://www.domain.com/$1 [R=301,L]
# Remove trailing slash
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
They worked perfectly when I just used one of them, but when i put them together, the page just keep loading like forever.
Please help me to find a way that can use both of them in the same .htaccess :(
Many thanks :)
© Stack Overflow or respective owner