I am trying to run my codeigniter website on the server.But I don't have a clue that what settings should I perform.
I find the following link to move the files and do the specified settings but still its not showing me the home page of my website.
Here's what I've done till now.
I moved the codeigniter website's application and system folder on the root directory while my .htaccess file along with my assets and index.php is inside public_html.
Here's my directory structure.
-/home/mysite
-public_html
-index.php <-- the path for system is set to '/home/mysite/system' and for application folder is '/home/mysite/application'
-.htaccess
-system
-application
I've performed the following settings as mentioned in the link.
$config['index_page'] = "";
$config['base_url'] = "http://myurl.com/";
$config['server_root'] = $_SERVER['DOCUMENT_ROOT'];
$config['uri_protocol'] = 'AUTO';
$route['default_controller'] = "home_controller";
Here's my .htaccess file.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Now I don't know why my home page is still not appearing when I enter the url to my site.
upload your application folder, system folder, assets folder, index.php, .HTACCESS inside your public_html folder
You need to do few steps:
update 'application/config/config.php' for base_url
update 'htaccess' file for RewriteBase (if needed)
update file permission (if needed)
update 'aplication/config/database.php' for database settings
if still you face issue, then you need to debug like:
print something in index controller and walk through along the function sequence called and then views.
Related
I currently host my Laravel website on Hostinger, but when I have a image on my page, the url doesn't go to website.com/public/img_url, but it goes to website.com/img_url, does anyone know how this works on Hostinger, and how I can fix this?
Currently my whole project is in my public_html, with no other folders besides it.
The right solution was changing my htaccess to:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
You should need to add a public inside asset function to access a public folder on the shared hosting server.
So you need to change the fetch path of files Example: asset('user/photo.jpg') to asset('public/user/photo.jpg') in each line of code where you need to fetch files from the public directory.
I am having a problem after hosting my codeIgniter project on live shared hosting server.
Before doing that, I changed few things on my local server.
.htaccess file-
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
.config.php inside config folder-
$config['base_url'] = '';
$config['index_page'] = '';
to let it work properly on my local server without writing index.php in URL. But when I moved it to live server, I changed base_url as-
http://crm.sachinartani.com
as I am hosting it on my subdomain, but it always output-
404 Page Not Found
The page you requested was not found.
I watched all videos on YouTube and traversed all questions of StackOverflow but none of the solutions helped me. There is a folder aside application folder namely inc which contains CSS and JS files I am using in my project. I am able to access those files by URL as - http://crm.sachinartani.com/inc but I cannot access any controllers and views like this.
I wonder what is the difference between my page offline and online?
After downloading my page offline I need to add (index.php) after my folder file in order to make it viewable?
http://localhost/gsaconst/index.php/articles/news
my online page would be
http://www.gsa-constructionspecialist.com/articles/news
How to delete the index.php in the offline page and still make it viewable not error message like:
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
you need to add .htaccess file in offline directory
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
and also make sure you remove index.php from config file $config['index_page'] = 'index.php';
find config file application/config/config.php
I'm relatively new to CI and I'm wondering if anyone knows how to set the default page of CI. I just transferred my files from my local server to my remote server and am having some problems. Firstly, I think it's important to note that I edited the .htaccess file so that the index.php was removed from the URL.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Secondly, in my config.php file, I have:
$config['base_url'] = '';
$config['index_page'] = 'sportstream';
sportstream is the name of a controller that is found in the application/controllers/ folder. From my experiences without using CI (or any other framework), the index.php file inside of the public_html folder on the remote server is the one that is loaded by default upon visiting a site. But, with CI, whenever I try to visit my domain name, a 404 error is returned. I have tried setting to base_url to http://www.mysite.com without any luck.
Does anyone here know how to make it so that upon visiting http://www.mysite.com that http://www.mysite.com/sportstream will be loaded?
You need to add a RewriteBase in your .htaccess file:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
NOTE: I have added a ? after the index.php as well.
I would also set the follow to an empty string (after you have tried the above):
$config['base_url'] = '';
$config['index_page'] = '';
Finally, in your routes.php file:
$route['default_controller'] = 'sportstream';
Update
In application/config/database.php you need to change your database driver. On your localhost, MySQLi was the database driver set. On your remote server, however, MySQLi was not installed, so changing it to MySQL should fix the issue.
//old - works on local server
$db['default']['dbdriver'] = 'mysqli';
//new - works on remote server
$db['default']['dbdriver'] = 'mysql';
For some reason, Codeigniter just "breaks" and shows the blank screen with no errors.
You have to set default controller in $route['default_controller'] ="sportstream"; it is located in aplication/config/route.php, So when visitinghttp://www.mysite.com/thesportstream` controller will be loaded by default.
Check about default controller in User guide
Switch back the $config['index_page'] = '';
If you renamed the index.php then you must enter the index_page name in config or else you can keep it blank.
Recommended Codeigniter starter guide: http://net.tutsplus.com/tutorials/php/codeigniter-basics/
I have developed a kohana project 2.4 version, with i has been developed by configuring virtual host and we are accessing it using some domain aa.com, now i have to move the project to folder named kohana and make it access via aa.com/kohana. If i access it this way then my url changes, So the css & js file are not included since the src url i have provided like /public/css/ so it's not working, same goes for calling a controller. like il be calling a controller using this format /user/login/. now the url when i click to shows like aa.com/user/login which is not found, in turn it should automatically comes like aa.com/kohana/user/login. Is there any way by changing the htaccess file or hacking routes.php file. ?
I should able to automatically append /kohana/ before the url.
Please suggest me a method how it can be achieved.
Yes there is!
I've only started after kohana 3.0 but you can just change the rewritebase.
In your .htacces it probably says "rewritebase /"
Change this to your new directory. "rewritebase /kohana/"
If 2.4 has a bootstrap (i'm not sure) somewhere it should say "base_url". You change this the same as the .htaccess. /kohana/.
edit: here's an example:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /kohana/
# Protect application and system files from being viewed
RewriteRule ^(application|modules|system) - [F,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]