removing index.php (docs are kinda sucky for this) |
[eluser]codeamanny[/eluser]
I have been trying to follow the docs and have hit walls the whole way In the docs it says Quote:removing the index.php file But it doesn't say the following: where you should put the .htaccess file ( I put it into my apps folder) however everytime I post a form, the index.php comes back. I have tried to remove the index.php using the $config option, however all my forms then post to the correct url, however it just goes to 404 errors! Can someone help? however
[eluser]xwero[/eluser]
If you put it where the index.php file is you will have no problems.
[eluser]codeamanny[/eluser]
its stil not working, If I put this into the url http://virtual/project/company/project/b...ivepayment it doesn't work however if i put in http://virtual/project/company/project/b...ivepayment it works.
[eluser]codeamanny[/eluser]
It turns out htaccess doesn't work with the current version of windows we are using, so I have to just make do. How do I reference images if I am calling them from a view? eg controller http://virtual/project/company/project/b...ivepayment loads viewpayment.php in the views folder
[eluser]xwero[/eluser]
.htacces files are cascading. If you put the file in your root directory all subdirectories will have the same redirecting rules. if you put it in a sub directory with other redirection rules those rules are only valid for that subdirectory and all its subdirectories. Here you can find a good introduction to .htaccess . It's not really in the reach of CI to explain mod_rewrite because there are other webservers than apache and they can have other ways of rewriting urls.
[eluser]codeamanny[/eluser]
@xwero Thanks for the help, however my server doesn't support htaccess! I just worked it out. How do I reference images from within my view?
[eluser]ngkong[/eluser]
put the htaccess at directory http://virtual/project/company/project/branches/codign/ and the htaccess should be: RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /project/company/project/branches/codign/index.php/$1 [L] set line 3 as the path to your codeigniter index.php directory (from webserver root) while you upload the script to remote server, change htaccess back to normal (if your script run at domain root) RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L]
[eluser]Michael Ekoka[/eluser]
If your apache server's settings do not allow override, htaccess files will have no effect. You'll need to set the AllowOverride to All in the apache configuration file.
[eluser]captainbeef[/eluser]
Hey, The way I reference images is to keep the images in a folder under the site root folder. Then when you reference the images in the view files, you just use a leading slash and the image folder name, thus: Code: <img src="/images/image1.gif"> When this is called in the browser, the image path is appended to the site domain. This then loads the image, independent of the framework paths. This method can be used to store and reference any files that are to be made globally available and are called in html (i.e. at the client end of things), such as css, pdf's etc
[eluser]jrad[/eluser]
Had the same problem with .htaccess file.. My solution was this: 1. Set your config.php file $config['base_url'] = "http://127.0.0.1/path/of/codeigniter"; #if you use http://127.0.0.1/path/to/ codeigniter/ in your browser $config['base_url'] = "http://localhost/path/of/codeigniter"; #if you use http://localhost/path/to/ codeigniter/ in your browser if you placed codeigniter in the root folder set base_url to http://localhost/ or http://127.0.0.1/ $config['index_page'] = ''; #default is $config['index_page'] = "index.php"; 2. Make the .htaccess file as mentioned above in your system folder. 3. Edit your Apache httpd.conf file Option Indexes FollowSymLinks AllowOverride All 4. Restart Apache. |
Welcome Guest, Not a member yet? Register Sign In |