Redirect before rewrite
        Posted  
        
            by 
                Kirk Strobeck
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by Kirk Strobeck
        
        
        
        Published on 2011-01-04T06:25:02Z
        Indexed on 
            2011/01/04
            6:55 UTC
        
        
        Read the original article
        Hit count: 373
        
.htaccess
Had an issue where I need to redirect old URLs, but not disable the mod_rewrite for page structure.
redirect 301 /home.html http://www.url.com/
It needs to live on the Symphony 2.0 .htaccess file
### Symphony 2.0.x ###
Options +FollowSymlinks -Indexes
<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteBase /
 ### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"
 RewriteCond %{REQUEST_FILENAME} favicon.ico [NC]
 RewriteRule .* - [S=14]
 ### IMAGE RULES 
 RewriteRule ^image\/(.+\.(jpg|gif|jpeg|png|bmp))$ extensions/jit_image_manipulation/lib/image.php?param=$1 [L,NC]
 ### CHECK FOR TRAILING SLASH - Will ignore files
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_URI} !/$
 RewriteCond %{REQUEST_URI} !(.*)/$
 RewriteRule ^(.*)$ $1/ [L,R=301]
 ### ADMIN REWRITE
 RewriteRule ^symphony\/?$ index.php?mode=administration&%{QUERY_STRING} [NC,L]
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f 
 RewriteRule ^symphony(\/(.*\/?))?$ index.php?symphony-page=$1&mode=administration&%{QUERY_STRING} [NC,L]
 ### FRONTEND REWRITE - Will ignore files and folders
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*\/?)$ index.php?symphony-page=$1&%{QUERY_STRING} [L]
</IfModule>
######
Updated
redirect 301 ^home.html http://www.url.com/ [L]
### Symphony 2.0.x ###
Options +FollowSymlinks -Indexes
<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP_HOST} !^www\.krista-swim\.com [NC]
 RewriteRule ^(.*)$ http://www.krista-swim.com/$1 [L,R=301]
 RewriteBase /
 ### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"
 RewriteCond %{REQUEST_FILENAME} favicon.ico [NC]
 RewriteRule .* - [S=14]
 ### IMAGE RULES 
 RewriteRule ^image\/(.+\.(jpg|gif|jpeg|png|bmp))$ extensions/jit_image_manipulation/lib/image.php?param=$1 [L,NC]
 ### CHECK FOR TRAILING SLASH - Will ignore files
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_URI} !/$
 RewriteCond %{REQUEST_URI} !(.*)/$
 RewriteRule ^(.*)$ $1/ [L,R=301]
 ### ADMIN REWRITE
 RewriteRule ^symphony\/?$ index.php?mode=administration&%{QUERY_STRING} [NC,L]
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f 
 RewriteRule ^symphony(\/(.*\/?))?$ index.php?symphony-page=$1&mode=administration&%{QUERY_STRING} [NC,L]
 ### FRONTEND REWRITE - Will ignore files and folders
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*\/?)$ index.php?symphony-page=$1&%{QUERY_STRING} [L]
</IfModule>
######
© Server Fault or respective owner