Welcome Guest, Not a member yet? Register   Sign In
working htaccess for titer 3 on local xampp
#1

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
Reply
#2

(This post was last modified: 06-04-2017, 12:31 PM by donpwinston.)

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)
Simpler is always better
Reply
#3

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
Reply
#4

(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/g...x-php-file
and
https://www.codeigniter.com/user_guide/g...ments.html
Reply
#5

(This post was last modified: 06-05-2017, 02:18 AM by Corsari.)

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/tutor...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
Reply
#6

The problem with .htaccess is that it is different for different server settings and environments.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

(This post was last modified: 06-05-2017, 05:14 AM by Corsari.)

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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB