CodeIgniter Forums
working htaccess for titer 3 on local xampp - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: working htaccess for titer 3 on local xampp (/showthread.php?tid=68168)



working htaccess for titer 3 on local xampp - Corsari - 06-04-2017

hello to all this community

i'm newbie on CI

i'm doing my first tests and so I'm follwoing the official codeigniter tutorial 

The welcome shows but the home and about pages are returning 404

The routes.php file has been configured in such a way that currently the index php is still in the url

So looks like now it is or it could be matter of the .htaccess file

Well 
How to setup the .htaccess on an xampp installation for the CodeIgniter 3 official tutorial?

Thank you for the working setup


RE: working htaccess for titer 3 on local xampp - donpwinston - 06-04-2017

SetEnv CI_ENV development

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]


(The index.php no longer needs to be in the url)


RE: working htaccess for titer 3 on local xampp - Corsari - 06-04-2017

Thank you

I'm wondering why the official CodeIgniter guide is missing this point

The guide is the basic of the basic, so looks intended mainly for newbies

If it is, this piece of code and also a HUGE WARNING are missing.

I have been stuck on this for hours and hours 

This would//could make many to abandon the official tutorial and maybe CI too.

P.S. How does htaccess will change when the CI from a subdir level, is moved to root?

- root of xampp test environment 
- root of a general purpose webhosting with a FQD an again Apache as webserver engine


(better to ask now instead to as later in a new thred)

Thank you


RE: working htaccess for titer 3 on local xampp - Paradinight - 06-05-2017

(06-04-2017, 11:37 PM)Corsari Wrote: Thank you

I'm wondering why the official CodeIgniter guide is missing this point

The guide is the basic of the basic, so looks intended mainly for newbies

If it is, this piece of code and also a HUGE WARNING are missing.

I have been stuck on this for hours and hours 

This would//could make many to abandon the official tutorial and maybe CI too.

P.S. How does htaccess will change when the CI from a subdir level, is moved to root?

- root of xampp test environment 
- root of a general purpose webhosting with a FQD an again Apache as webserver engine


(better to ask now instead to as later in a new thred)

Thank you

https://www.codeigniter.com/user_guide/general/urls.html#removing-the-index-php-file
and
https://www.codeigniter.com/user_guide/general/environments.html


RE: working htaccess for titer 3 on local xampp - Corsari - 06-05-2017

PREMISE: thank you to all of you for being patient , I'm learning both about php and codeigniter and I understand this will be a long challenge :-)

Hello Paradinight thank you for the links

please allow me to say that placed where they are, they are not helping a newbie that is following the official tutorial on the official Codeigniter guide.

Especially the first one, because it is hinting how to remove the the index.php from URL, this is misleading.

My personal opinion about htaccess (so far for what I understand) is that this should be a SHARP step of the official Codeigniter tutorial and it should be an highlighted step which should teach something like

Quote:"for the examples in this tutorial to work, so for  the routes to work, you must create an .htaccess file in the root of your project and insert the following rules..."

do you agree?
Unless Codeigniter may work either without an .htaccess , if this is the case, sorry for pointing this out. But anyway, following the tutorial it does develop in a manner that makes htacces mandatory, so for the tutorial itself, it is a needed step.

I mean, read here https://codeigniter.com/user_guide/tutorial/static_pages.html
I kindly ask you to be objective: does this teaches and inform that the htaccess modification is a MUST? Dodgy

Otherwise many newbies like me (hard of comprehension) , will get stuck as soon they create the first Controller Confused

Also,

referred to my P.S.

I have read the links, but I don't find any distinction for an htaccess for projects resident in a subdir of e.g. a local xampp or in the root of a local xampp and the same for a real webserver with the same distinction, so a real www like www.myserver.ext with Apache and codeigniter app in a subdir (first case) and as root of the www.myserver.ext (second case)

Is the snippet

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

expected to work for all the 4 cases? Or are they needed different .htaccess rewrite conditions and rules for them?
- codeigniter as subdir in a local xampp
- codeigniter as root in a local xampp
- codeigniter as subdir in a real FQD www Apache server
- codeigniter as root in a real FQD www Apache server


Thank you for clarifying


RE: working htaccess for titer 3 on local xampp - InsiteFX - 06-05-2017

The problem with .htaccess is that it is different for different server settings and environments.


RE: working htaccess for titer 3 on local xampp - Corsari - 06-05-2017

I understand

In effects my P.S. was slightly off topic

Here the point ha been solved :-) now my tutorial is going on pretty fine.

In my personal opinion, It does remain the problem on how the official tutorial is presented on the routes passage, but this again is off topic :-)

Thank you for the support to all of you

I'll be back when ready with more advanced techniques requests (when ready)

P.S. Are they available third party helpers and libraries repositories for CodeIgniter?

Thank you

Robert