htaccess for codeigniter

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

Copy this code and paste it in your HTML
  1. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3. RewriteBase /
  5. #Removes access to the system folder by users.
  6. #Additionally this will allow you to create a System.php controller,
  7. #previously this would not have been possible.
  8. #'system' can be replaced if you have renamed your system folder.
  9. RewriteCond %{REQUEST_URI} ^system.*
  10. RewriteRule ^(.*)$ /index.php?/$1 [L]
  12. #When your application folder isn't in the system folder
  13. #This snippet prevents user access to the application folder
  14. #Submitted by: Fabdrol
  15. #Rename 'application' to your applications folder name.
  16. RewriteCond %{REQUEST_URI} ^application.*
  17. RewriteRule ^(.*)$ /index.php?/$1 [L]
  19. #Checks to see if the user is attempting to access a valid file,
  20. #such as an image or css document, if this isn't true it sends the
  21. #request to index.php
  22. RewriteCond %{REQUEST_FILENAME} !-f
  23. RewriteCond %{REQUEST_FILENAME} !-d
  24. RewriteRule ^(.*)$ index.php?/$1 [L]
  25. </IfModule>
  27. <IfModule !mod_rewrite.c>
  28. # If we don't have mod_rewrite installed, all 404's
  29. # can be sent to index.php, and everything works as normal.
  30. # Submitted by: ElliotHaughin
  32. ErrorDocument 404 /index.php
  33. </IfModule>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.