Home ›
Setting up redirects in .htaccess for all paths matching a patternSetting up redirects in .htaccess for all paths matching a pattern
Submitted by Benjamin Melançon on May 15, 2011 - 5:12am
In a Drupal .htaccess file, these rules must come before RewriteBase.
So:
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^raw/(.*)$ http://data.agaric.com/$1 [R=301,L]
# All the usual rules
</IfModule>
That rule removes the 'raw/' from all incoming URLs and permanently redirects (301) to the non-raw version.
Some of the best writeup for this sort of URL rewriting / redirecting happens to be on a Drupal handbook page: http://drupal.org/node/38960
Searched words:
drupal redirect
rewrite paths
Comments
Post new comment