My CodeIgniter project is not running on WAMP server
I have a project developed in CodeIgniter that works fine on XAMPP server, but doesn't work on WAMP server.
I changed
$config['index_page'] = 'index.php'; to $config['index_page'] = '';
and .htaccess I have
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
The website home page is displayed correctly. But no link works whenever I click the link to the link server home page, in the french version.
The project runs correctly on WAMP only if the URL has an index.php.
eg.
http://localhost/codeigniter/welcome/view (This link doesn't work)
http://localhost/codeigniter/index.php/welcome/view (Links works properly)
source to share
Enable mod_rewrite in the file httpd.conf
In my case, I installed WAMP on my local C drive
to find the httpd file just go to C:\wamp\bin\apache\apache2.2.6\conf
open the httpd.conf file with notepad editor, then find the following line:
#LoadModule rewrite_module modules/mod_rewrite.so
and uncomment it
save the file and restart Apache for the new setting to take effect.
source to share
check RewriteBase
in .htaccess
file. it would be like below
RewriteBase /your project folder name/
copy below code and paste it into your .htaccess
file
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /codeigniter/
#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]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
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]
#RewriteRule ^page/(.*)$ index.php?/#$1 [R=301,L,NE]
# If we don't have mod_rewrite installed, all 404 # can be sent to index.php and everything works fine. # Submitted by: ElliotHaughin
ErrorDocument 404 /index.php;
hope this helps you. and check one. I am your url. if there is a ~, then the file .htaccess
will be different. otherwise the above code will work. Thank.
source to share