Skip to content

Instantly share code, notes, and snippets.

@calvinte
Created April 25, 2012 23:44
Show Gist options
  • Select an option

  • Save calvinte/2494508 to your computer and use it in GitHub Desktop.

Select an option

Save calvinte/2494508 to your computer and use it in GitHub Desktop.
Patch for Drupal 7 .htaccess that enables Rewrite for url (http://www.example.com/... will be redirected to http://example.com/...)
diff --git a/.htaccess b/.htaccess
index e59cd99..e24dd49 100644
--- a/.htaccess
+++ b/.htaccess
@@ -84,8 +84,8 @@ DirectoryIndex index.php index.html index.htm
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment the following:
- # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
- # RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
+ RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
+ RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
@tanarurkerem
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment