Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.example.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>
######
share|improve this question

migrated from serverfault.com May 30 '11 at 21:45

This question came from our site for system and network administrators.

Try this code in your .htaccess file:

  • RewriteRule ^home(.*) http://example.com/ [R=301,L]
share|improve this answer
    
The important point here is that you've changed the mod_alias Redirect to a mod_rewrite RewriteRule to perform the redirect. Different modules execute at different times (and it can even vary from server to server). By default mod_rewrite will execute before mod_alias, regardless of their apparent order, so it's quite possible that your original Redirect is simply being skipped. It is recommended to never mix redirects from both modules, because of this "unpredictable" behaviour. (In addition... the (.*) at the end of the RewriteRule pattern is not required here.) – w3dk May 21 at 15:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.