Reputation: 55
I have installed ubuntu 12.04 and I have complete requirements(apache,mysql and php5) for running php projects. Projects which are not in codeigniter are working well. Within codeigniter , when I load the project the default controller loads the index_view but when I click to other controllers; they wont work with error and display error
I realized that the .htaccess wont work; then the /etc/apache2/httpd.conf file is empty I would like to request a sample of basic configuration of httpd.conf file so that my htaccess file can work. If any suggestion that can help me to arrive at some results would be appreciated. Thanks. My httaccess is given below
RewriteEngine On
RewriteBase /
### Canonicalize codeigniter URLs
# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(platform(/index)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# Enforce www
# If you have subdomains, you can add them to
# the list using the "|" (OR) regex operator
RewriteCond %{HTTP_HOST} !^(localhost|academic) [NC]
RewriteRule ^(.*)$ http://localhost/academic/$1 [L,R=301]
# Enforce NO www
#RewriteCond %{HTTP_HOST} ^www [NC]
#RewriteRule ^(.*)$ http://domain.tld/$1 [L,R=301]
###
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
Upvotes: 1
Views: 4182
Reputation: 3149
This trusty one has never done me wrong:
RewriteEngine On
RewriteBase /academic/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/ [L]
ErrorDocument 404 /index.php
Upvotes: 1