Drupal 7 301 redirect in htaccess file

November 30, 2018

A 301 redirect in an .htaccess file isn't that hard. 

But Drupal has a really long and complicated .htaccess file. 

In this use case we will add a 301 redirect in the .htaccess file of a Drupal 7 install on shared hosting. Drupal is installed in the webroot. 

What should be toggled on? 

These should be on: 

  • Options +FollowSymLinks
  • RewriteEngine On

Where should I place the 301-redirect code? 

I put my code just after: 

# RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]

And before: 

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a

An example of a RewriteRule that redirects projects-0 to projects: 

RewriteRule ^projects-0 /projects [R=301,NC,L]

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.