I am new to codeigniter while redirecting a page index.php is not loading by default,So i have tried the below code in htaccess file. I have installed php 5.3.10, apache server and postgres database. so if any new configuration have to be done apart from changing .htaccess and httpd.conf then please let me know. I have seen previous questions asked on the same issue and i referred everything from those questions but still I am not able to solve this. please let me know what extra things to be done.
.htaccess file
<IfModule mod_rewrite.c> RewriteEngine On #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 #This last condition enables access to the images and css folders, and the robots.txt file RewriteCond $1 !^(index\.php|public|images|robots\.txt|css) RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^/(index\.php|assets/|humans\.txt) RewriteRule ^(.*)$ index.php/$1 [L]
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
httpd.conf file ServerName localhost
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
Following things you should do for avoiding index.php in url
Always make sure you have .htaccess file. which you have already.
Include contents in .htaccess which @charlie has suggested above.
Edit httpd.conf file using nano command and include main thing keep allowoveride All
First disable rewrite mode and enable it again then restart apache2 server using following commands.
sudo a2dismod rewrite //which disables the rewrite mode
sudo a2enmod rewrite //which enables the rewrite mode
sudo service apache2 restart //which restarts your apache
Thats all you need to do. All the best.