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>
Related
Can any one help me?
I code a web app in php with codeigniter
it works well on my localhost but when I upload it on live server it loads only home page. For other pages it gives a error
''No input file specificed''
When I do google about it.
There are many tricks like change .htaccess but no one works.
What should I do
Check this
It loads foodpark.tk
But does not load
Foodpark.tk/category/index
And all the other pages
this is my .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|public|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
Options -Indexes
i also tried to put a question mark after index.php in .htaccess but it gives 404 error from hosting
Sorry for my poor english
Try this in your .htaccess file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
Try this.
In your .htaccess file Change
RewriteRule ^(.*)$ index.php/$1 [L]
To
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
Try below code in .htaccess. This is from my working project. Hope you are using godaddy server.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
I am new in codeigniter and i am trying to remove index.php from URL in Codeigniter but not able to do this.
I wrote code in my .htaccess file-
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
My Apache mod_rewrite is enable.
But still got 404 error when i am trying to access any controller without using index.php.
Please help.
Thanks.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
</IfModule>
Is the code I'm using, it works on every hosting platform I've used it on.
This should help you,
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
check this code of htaccess file.
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|public|images|css|js|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
you can find your answer refference here
My .htaccess file is not working
moreover can you share your base url with us? as this error may be due to wrong baseurl set.
I recently moved my codeigniter application from a subdomain to operate under my domain.
Basically I moved it from:
https://account.mywebsitehere.com
To:
https://mywebsitehere.com/account
Now when I try to access anything like /invoices it removes the /account from the url and results in a not found page. I have changed the base url in the config file but it is still resulting in this error.
Other than going through the entire application and changing every link to be /account/... How can I make the application work under the /account in the url?
My .htaccess file located at public_html/panda/.htaccess is as follows:
RewriteEngine on
RewriteCond $1
!^(index\.php|robots\.txt|files\/images|files\/css|files\/js|files\/swf|files\/upload)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://mywebsitehere.com/panda/$1 [R,L]\
Try to change base_url to:
$config['base_url'] = 'https://mywebsitehere.com/account';
just put that code in .htaccess file and try it
RewriteEngine On
RewriteBase /account/
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
first, upload an image to the root directory and see if you can access it within the browser.
if you cant access it , check your server's configuration and your .htaccess file.
I search a lot websites and lots of links and i follow the same for enable htacces in wamp but facing the problem and now as default use index.php even when i run the page without index.php its not working even msg comes page not found on server i already enable in apache module also the httpd.conf file remove the # sign from rewrite module and i use the mention below code in htaccess file for codeigniter for suggestions i share htaccess code
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
please suggest so i can solve this issue on wamp server
Try this code in your htaccess :
RewriteEngine On
RewriteBase /my_project_name/
# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
Try this
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]
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?
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
The path /welcome does not exist on the server, the rewrite should be something like:
RewriteRule ^(.*)$ index.php?$1 [L]
<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>
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.