Drupal .htaccess for enabling clean url's


/ Published in: Apache
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # Various rewrite rules.
  2. <IfModule mod_rewrite.c>
  3. RewriteEngine on
  4.  
  5. # If your site can be accessed both with and without the 'www.' prefix, you
  6. # can use one of the following settings to redirect users to your preferred
  7. # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  8. #
  9. # To redirect all users to access the site WITH the 'www.' prefix,
  10. # (http://example.com/... will be redirected to http://www.example.com/...)
  11. # adapt and uncomment the following:
  12. # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  13. # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  14. #
  15. # To redirect all users to access the site WITHOUT the 'www.' prefix,
  16. # (http://www.example.com/... will be redirected to http://example.com/...)
  17. # uncomment and adapt the following:
  18. # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  19. # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
  20.  
  21. # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  22. # VirtualDocumentRoot and the rewrite rules are not working properly.
  23. # For example if your site is at http://example.com/drupal uncomment and
  24. # modify the following line:
  25. # RewriteBase /drupal
  26. #
  27. # If your site is running in a VirtualDocumentRoot at http://example.com/,
  28. # uncomment the following line:
  29. # RewriteBase /
  30.  
  31. # Rewrite URLs of the form 'index.php?q=x'.
  32. RewriteCond %{REQUEST_FILENAME} !-f
  33. RewriteCond %{REQUEST_FILENAME} !-d
  34. RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
  35. </IfModule>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.