Reputation: 44066
I have a codeigniter folder that has my entire application with all the many pages of the site but maybe i dont understand the way to link the home page....
here is my problem, I have a folder named ci and the content is this format
~/Sites/ci$ ls -la
total 56
drwxr-xr-x@ 18 tamer staff 612 Apr 8 17:26 application
drwxr-xr-x 11 tamer staff 374 Apr 11 09:46 css
drwxr-xr-x 6 tamer staff 204 Mar 24 14:20 graphics
-rwxr-xr-x@ 1 tamer staff 6321 Apr 7 12:20 index.php
drwxr-xr-x 17 tamer staff 578 Apr 11 09:54 js
-rwxr-xr-x@ 1 tamer staff 2496 Apr 7 12:20 license.txt
drwxr-xr-x@ 10 tamer staff 340 Apr 7 12:20 system
drwxr-xr-x@ 16 tamer staff 544 Apr 7 12:20 user_guide
As you can see the folder named ci has my application folder and if i put this on my server i will have to navigate to http;//mysite.com/ci
which is not what i want. How do i make this work without having to use ci in the url
Upvotes: 0
Views: 4969
Reputation: 95
You have to take everything out of the ci/ folder and place it on your domain's public_html/ directory inside the server, depending on what type of Apache setup you have. Almost always, it tends to be public_html/. So dump everything into that folder(including your index.php) and your site's home url should now be http://yoursite.com or .org or whatever.
On a Codeigniter specific note: if you want to make your site more secure. You could take it one step further and leave the Application and system files 1 directory up inside your root folder which will make it unreachable by browsers as they cannot index anything outside public_html. And then just place your index.php and your assets inside public_html and change your CI global variables to one directory above (../). There are a few tutorials and videos on how to do this, if you want. I can't seem to find the ones I know but I'm sure if you google it, it won't be long before you find them.
Again, this is more of a Codeigniter specific thing but you can do something similar with other MVC sites, depending on the setup, of course.
Upvotes: 0
Reputation: 1691
Home or the root page is always
www.wxample.com/index.php/main controller name
If you have removed the index.php its simply
www.wxample.com/main controller name
Assets are relative to the application folder. So if you have a view in the view folder and your CSS file is in the root of public html, then you would address the css file like this
link_tag("/css/style.css")
You home can also be expressed as base_url (in URL helper) it. This must be set up in your index.php file as http://www.mysite.com
Upvotes: 0
Reputation: 2667
I'm not totally sure about this (so correct me if I'm wrong), but the way that Codeigniter allows you to use nice urls is by using the .htaccess file to do rewrite. So everything goes through the index.php file. So if this is true you could try to move the index.php and the .htaccess. Then you would just update the index.php to point to the application and system folder (ci/application and ci/system). You will then be able to access the site by visiting http://mysite.com.
Haven't actually tried this and I'm assuming your using a .htaccess file for rewriting. And that you are using Absolute Urls to your assets.
Upvotes: 1
Reputation: 1492
If you have access to apache configs then change the docroot of your virtal host to /ci. If not and you are on a shared hosting package then you will have to move all the files from /ci to / or change the rewrite rules in .htaccess.
Upvotes: 0