Codeigniter URL not working without index.php - codeigniter

I've just set up a new webiste http://www.reviewongadgets.com
But there is a problem with URL rendering
When I put an URL as below it's not working and gives page not found error
http://www.reviewongadgets.com/latest-mobile
But it works with
http://www.reviewongadgets.com/index.php/latest-mobile
I don't want to show index.php in my URL, it should be http://www.reviewongadgets.com/latest-mobile
, can you please suggest me what should I do ?
This is my .htaccess file contents:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Config file contents:
$config['base_url'] = "http://www.reviewongadgets.com";
$config['index_page'] = "";
Same type configuration working for my another website
Changed my .htaccess content to
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

The most common solution to this problem is usually the missing question mark ? after index.php in .htaccess, so
RewriteRule ^(.*)$ index.php/$1 [L]
should be
RewriteRule ^(.*)$ index.php?/$1 [L]
E.G. on my Windows XAMPP, I do not need the "?", but in a Linux hosting environment it is usually required.

i aggree with Vlakarados, but i will share my .htaccess setting
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]
its work perfectly.
i hope that's work to for your CI website

You might not have rewrite_module module loaded.
Try running below command.
sudo a2enmod rewrite

Related

When i use index.php/User/login its working, But when i use User.login its not working even after removing of index.php in codeigniter

When i use
index.php/User/login its working, But when i use User/login its not working even after removing of index.php in codeigniter, can anyone say what is wrong with my code? its on live server of root directory
my htaccess file is
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
Please try below code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I've been using this code for many years. I think it could work for you.

Remove index.php from URL in CI?

I removed index.php from the URL in CodeIgniter. I have already changed the .htaccess file data. But I want to know that is there any other way to remove the index.php from the URL or through any other .htaccess data. Means this is only a way or not.
In .htaccess file I wrote this :
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
Try This code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
and do not forget to null index value in config file
$config['index_page'] = '';
Try this :
Make sure you have enabled rewrite_module on your Apache modules
.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|indexcp\.php?|resources|robots\.txt)
RewriteRule ^([A-Za-z0-9_/.-]+)$ index.php?/welcome/$1
Open config.php :-
$config['index_page'] = '';
$config['base_url'] = 'http://www.example.com/'; //your site name
$config['uri_protocol']= 'REQUEST_URI';
Options +FollowSymLinks
RewriteEngine on
# Send request via index.php (again, not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Codeigniter No input file specified

I know that this question has been asked maybe thousands of time before, I looked at most of them and could not fix for my case :s
I have a codeigniter framework installed on godaddy hosting company and i read that i have to create a .htacces file and put this code into:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
But this does not fix for my case, is it that I have this site hosted under another domain?
for ex the structure of my ftp looks like below:
/
facelajm
studenti
fxclod
and I am trying to get the site following url www.facelajm.com/studenti which opens the main page fine, but when i try to login or reg it just returns me No input file specified.
Anyone could help me?
Seems that in certain configurations the CI core misses the rules, the .htaccess I'm using now:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
ErrorDocument 404 index.php
In my case (dev: a subfolder, prod: an "addon domain") the magic was provided by those two extra lines:
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
Source:
http://www.diegodicamillo.com.ar/blog/2012/09/19/no-input-file-specified-codeigniter-error-problema-resuelto/
From your question what i understand is you are running the codeignitor in a subfolder("studenti") of the domain("www.facelajm.com"). So the below .htaccess code will work.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
And also don't forgot to change the baseurl in configuration file(application/config/config.php) like below.
$config['base_url'] = "http://www.facelajm.com/studenti"
The above .htaccess which you used in your question will work for a sub domain.
So you can also create a sub domain and map the folder to the sub domain and use the code which you used in your question(For Reference i added below).
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
And also don't forgot to change the baseurl in configuration file(application/config/config.php) to the new subdomain(assuming new sub domain as http://codeignitor.facelajm.com/) like below.
$config['base_url'] = "http://codeignitor.facelajm.com/"
Here is the .htaccess file i have on a godaddy and it works fine:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Your problem might be the RewriteBase line if codeigniter is not in the root.
Please try this code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.)$ /index.php [L] or RewriteRule ^(.)$ index.php?/$1 [QSA,L]

Codeigniter mod_rewrite for both root and subdirectory

I have:
root/.htaccess
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
it works perfectly send all request(except file and folder) to index.php. I need it to work to my subfolder too.
I have .htaccess in subfolder root/demos/project contain:
RewriteOptions inherit
but doesn't work.
I try this in root/.htaccess
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
RewriteRule ^demos/project/(.*)$ demos/project/index.php/$1 [QSA,L]
Doesn't work.
this:
RewriteRule ^demos/project/(.*)$ demos/project/index.php/$1 [QSA,L]
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
get Internal Server Error 'missconfiguration'
and many several way, but everything I tried, I just get these: 501(default from server) and 404(from ci in root);
I use codeigniter in both root and demos/project and just want to 'hide' index.php from both, how to do this correctly ?
Thanks.
RewriteEngine on
RewriteRule ^(.*)$ /demo/project/index.php?/$1 [L]
does that work?
You could also just place another .htaccess in your demo/project folder.
EDIT:
try this:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /demo/project/index.php?/$1 [L]
EDIT2:
If you get a 404 not found page just change your config.php in root/application/config/config.php from the following:
$config['index_page'] = "index.php";
to:
$config['index_page'] = "";

Can't access the internal pages on CodeIgniter coded website

I have a website design prototype coded in Code Igniter 2.0 and I can't access the internal pages.
Here's the link to the website prototype: http://thepbe.org/
When I try to access internal pages, the browser just displays "No input file specified."
I think there's something wrong with my .htaccess file.
Here's the code in my .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php/$1
Open application/config/config.php file and make sure these options are set.
$config['index_page'] = “”;
$config['uri_protocol'] = “AUTO“;
then change your .htaccess file to this:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
Problem is due to absence of .htaccess file or incomplete .htaccess file.
You can use below code for .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Resources