I have a website source code which is built in codeigniter. I am trying to setup it into local wamp server but not working properly.
I have done following things:
Create a database UTF-8 with database name "fc2" and import live server database.
Configure aplications/config/config.php by setting base_url.
Configure aplications/config/database.php by set databse host,username,password and database name.
But its not working. (Screen Shot attached).
.htaccess file looks like this
Please help me for this issue.
Thanks in advance
the problem I think is with the htaccess. Try this
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /FOLDER_NAME/index.php?/$1 [L]
change FOLDER_NAME with the name of the local directory.
check whether you have put the base url in the config.php file with "http://".If not put "http://" and check
Please try this:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder_name/index.php?/$1 [L]
Also check if php installed properly in the stack.
Maybe reinstalling the WAMP stack might help.
Alternately I would be curious to check maybe in XAMPP to see if its something with the wamp.
try in .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^sys.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^app.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
assumming that index.php is your index page.
and sys is your system folder and app is your application folder.
and change in config.php
$config['index_page'] = '';
Related
I need help please.
I hosted a website designed with codeigniter on a remote server, but I can not access the pages.Jai as 404 page not found error.
Here is the contents of the config.php file
$ config ['base_url'] ='http://www.SitePhp';
$ config ['index_page'] ='';
Here is the content of the .htaccess file
Options -Indexes
RewriteEngine On
RewriteCond $1 !^(index\.php|assets/|robots\.txt)
RewriteRule ^ (. *)$ index.php/$ 1 [L]
Thank you.
htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
and shared host open mod_rewrite module.
$config['base_url'] ='http://www.SitePhp.com/';
will be
http://www.SitePhp.com etc.
I'm developing a web site using Codeigniter 3.X. my issue is that it works fine in localhost. now i uploaded the same to my server but it shows some error like "The page you requested was not found."
my htaccess file looks like this:
RewriteEngine On
RewriteBase /fold1/mainfold/
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 ^(index\.php|robots\.txt|favicon.ico|images|smileys|js|assets|css)
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /fold1/mainfold/index.php?/$1 [L]
what is issue with this code ? please help me...
Check the flowing:
Does the paths exist on your server?
Is mod_rewrite enabled on your Apache?
This code for hiding the index.php file .
And for Controller and method better to use route.php file.
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
I found the reason behind the issue. am using codeigniter3.X .Its file naming rules says that controller and model name should be starts with capital letter. i renamed my controller and model files. now the issue is resolved.
try this
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I have done this lots of time. But than also I am stuck here again (in a different server) and can not figure out what is the issue.
Completed htaccess editing
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /glt.me/CI/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /glt.me/CI/index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
rewrite module is enabled (as per customer care perons says)
Error :
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, cgiadmin#yourhostingaccount.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Test this case :
http://glt.me/CI/test
http://glt.me/CI/index.php/test
This is the simple way and it works fine for removing index.php from your url
RewriteEngine on
RewriteCond $1 !^(index\.php|uploads|css|js|lib|img|bootstrap|robots\.txt)
RewriteRule ^(.*)$ /manage/index.php/$1 [L]
instead of manage put your own application folder name.
Use following htaccess code to remove index.php from your codeigniter url
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ ./index.php/$1 [L]
Though your client confirmed the rewrite module is working, what don't you confirm it yourself, make a php file on the root of the project with the code below and try to browse the file.
<?php
if( !function_exists('apache_get_modules')){
echo 'Rewrite module not available';
}else{
if(in_array('mod_rewrite',apache_get_modules()))
echo 'Rewrite module enabled';
}
First check whether your apache is supporting mod_rewrite. If yes then add a .htaccess file. My codeigniter .htaccess file is:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
Finally in your config file, change your base_url, remove index.php from that if you have added.
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
RewriteRule ^pages/.*$ http://localhost/test/? [R=301,L]
I wanted to contribute here as I was having trouble myself. I'm using IIS5.1 for development only (Highly not recommended!)
1- Make sure that you config.php file has:
$config['index_page'] = '';
2- My app is not on the root folder, it's at localhost/CodeIgniter/. I updated config.php to:
$config['base_url'] = 'http://localhost/CodeIgniter/';
3- You need Mod-Rewrite capabilities. This is embedded with most servers, but IIS5.1 needs a separate tool. I used: IIS Mod-Rewrite by micronovae. It's free as long as you use it on localhost
I put the following code (Instead of CodeIgniter, put the name of the folder):
RewriteEngine on
RewriteCond $0 !^/CodeIgniter/(css|js|swf|images|system|tools|themes|index\.php) [NC]
RewriteRule ^/CodeIgniter/(.*)$ /CodeIgniter/index.php/$1 [L]
If your application is at the root, the code you should use would be simply:
RewriteEngine on
RewriteCond $0 !^(css|js|swf|images|system|tools|themes|index\.php) [NC]
RewriteRule ^(.*)$ index.php/$1 [L]
Hope it helps.
Only three steps are require to remove index.php from url in Codeigniter in WAMP environment.
1) Create .htacess file in parallel to application holder and just copy past the following code:
RewriteEngine On
RewriteBase /CodeIgniter/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
2) Change $config['index_page'] to blank in config.php in application folder as below:
$config['index_page'] = '';
3) Enable “rewrite_module” of apache.
Restart your apache and its done.
Details : http://sforsuresh.in/removing-index-php-from-url-of-codeigniter-in-wamp/
I have a little project that i developed for a client in codeigniter 2.1.4 and now, he insists to migrate to codeigniter 3 DEV version. I know that's not a good ideea but...
My problem is that i can't remove the index.php from the url.
This is my .htaccess file :
Options +FollowSymLinks
RewriteEngine on
# Send request via index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
I have removed the index.php from the config.php file
No luck
I reinstalled the LAMP server (i'm on Ubuntu 12.04'), reconfigured I have other projects on my local server developed on Codeigniter 2.1.4 and Laravel 4 and they work just fine but this one it's killing me.
Thank you!
I made this way:
Created the .htaccess in the root folder of the project with the content:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|css|js|images|robots\.txt)
RewriteRule ^(.*)$ index.php?$1 [L]
Then, in the config.php i modified this line.
From:
$config['url_suffix'] = 'index.php';
To:
$config['url_suffix'] = '';
Kindly add the below codes to .htaccess file and include it directly to your /codeigniter_project_folder/.htacess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
If your Apache server has mod_rewrite enabled, you can easily remove this file by using a .htaccess file with some simple rules.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Remove the ? after index.php
Add following lines in .htaccess file
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
And also Edit application/config/config.php file. with
$config[‘index_page’] = “”;
$config[‘uri_protocol’] = “AUTO“;
It will Work.
Make a .htacess file in your project root folder /Your_codeigniter_project_folder/.htacess and paste this code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
set a base URL in config.php file $config['base_url'] = 'http://yourhost/CI_project_folder/';
set URL suffix $config['url_suffix'] = '.php';
* If not work please check this *
Make sure in your root folder where .htacess stay there have not any file which name is same like your controller name.
Example: you have a users.php controller also you have a file in /Your_codeigniter_project_folder/users.php
If have please remove it /Your_codeigniter_project_folder/users.php
Make sure your server is rewrite mode on( remove # from start of this line)
LoadModule rewrite_module modules/mod_rewrite.so
create new .htaccess file on root of your CI project and add your code there. Do not change .htaccess file on application folder. That's work for me
Just Download CI version 2.2.0
Copy .htaccess and htaccess.txt from root and paste it in your Codeigniter 3 project.
Don't forget to change project name from .htaccess file.
Create an a new htaccess file in your www/project_folder or your htdocs/project_folder
Make sure mod_rewrite is working my using echo phpinfo()
Simply paste the following code and it should work:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /project_folder/index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
Change the project folder to that of your own
Be careful about the project path uppercase.
i.e. if the base_url is http://localhost/ci/ and the directory name is CI, it may not work.
I have clone the git repository again and made a clean install of the lamp and now it works.
I'll preface this by pointing out that I'm a massive noob with .htaccess stuff and server related stuff in general.
So I've built a website locally with wamp and I used a .htaccess file that I found from googling around.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /my_project_folder_name/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
I obviously replaced "my_project_folder_name" with the real folder name. This works perfectly on my local server. I decided to upload to site to my Nearly Free Speech server and I have been having some trouble with the mod_rewrite. I have no idea what I'm supposed to replace "my_project_folder_name" with, and I can't get it to work. I tried leaving it blank, and that worked, except for some reason this caused a bug that prevented POST data from being received by my scripts. Well, I'm assuming that's what caused the bug.
Could someone please point me in the right direction?
For help purpose just check.
Check apache setting is rewrite_module setting is correct ?
if your folder name consist of two seperate words such as " XYZ ABC" then try " XYZ_ABC" and do the same with you .htaccess file.
Looking at the file it belongs to codeigniter (PHP FRAMEWORK). So if you are not using it then try to use..
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /my_project_folder_name/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
Hope your problem will get solved.. :)