Posted By

julioantuneztarin on 06/17/11


Tagged

php htaccess codeigniter


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Kurt


.htaccess in Codeigniter


 / Published in: PHP
 

  1. <IfModule mod_rewrite.c>
  2. Options +FollowSymLinks
  3. RewriteEngine On
  4. RewriteBase /
  5.  
  6. # Removes access to the system folder by users
  7. RewriteCond %{REQUEST_URI} ^system.*
  8. RewriteRule ^(.*)$ /index.php/$1 [L]
  9.  
  10. # Checks to see if the user is attempting to access a valid file
  11. RewriteCond %{REQUEST_FILENAME} !-f
  12. RewriteCond %{REQUEST_FILENAME} !-d
  13. RewriteRule ^(.*)$ index.php/$1 [L]
  14.  
  15. # Add a extension to URL
  16. # RewriteCond %{REQUEST_FILENAME} !-f
  17. # RewriteCond %{REQUEST_FILENAME} !-d
  18. # RewriteRule ^(.*)$ $1.php [L,QSA]
  19. # http://domain/about -> http://domain/about.php
  20.  
  21. # Force "www." in the domain name.
  22. # RewriteCond %{HTTP_HOST} !^www.mydomain.com$
  23. # RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301]
  24.  
  25. </IfModule>

Report this snippet  

You need to login to post a comment.