Reputation: 13
I'm using the following .htaccess file to rewrite the URL's without index.php:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
The site is uploaded on my VPS, and when I enter it on, let's say:
http://1.1.1.1/~admin/
it works fine. Now when I want to navigate through the website to for instance:
http://1.1.1.1/~admin/welcome
it gives me the following error message:
The requested URL /home/admin/public_html/index.php/welcome was not found on this server.
Now when I access the welcome controller with the index.php in the URL:
http://1.1.1.1/~admin/index.php/welcome
It works fine again. What is going wrong here?
Upvotes: 1
Views: 1764
Reputation: 783
I use this:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [PT,L]
The "?" after index.php is required for godaddy. See this link: https://github.com/EllisLab/CodeIgniter/wiki/Godaddy-Installation-Tips
Upvotes: 1
Reputation: 81
I wrote this: Trouble Shooting Codeigniter on localhost
http://garyjohnson53.wordpress.com/2013/10/31/trouble-shooting-codeigniter-on-localhost/
Its not a polished article, but it walks you through a few of the common things with codeigniter.
MVC URI segments
example.com/class/method/id/
your condif.php usually in application/config
your index.php
your .htacess
Alias and apache
etc.
Upvotes: 0
Reputation: 832
<IfModule mod_rewrite.c>
RewriteEngine On
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>
</IfModule>
Upvotes: 0
Reputation: 31
The path /welcome does not exist on the server, the rewrite should be something like:
RewriteRule ^(.*)$ index.php?$1 [L]
Upvotes: 0