Welcome Guest, Not a member yet? Register   Sign In
mistake in default .htaccess file?
#1

(This post was last modified: 12-09-2020, 05:18 PM by sneakyimp.)

I'm looking at the default htaccess file distributed with CI4 and it looks to me like there's a mistake in the .htaccess rule:
Code:
    # Checks to see if the user is attempting to access a valid file,
    # such as an image or css document, if this isn't true it sends the
    # request to the front controller, index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]

If I'm not mistaken, that \s\S in square brackets should match whitespace characters. Shouldn't that last line be this?
Code:
RewriteRule ^(.*)$ index.php/$1 [L,NC,QSA][/code]

EDIT: I see from the apache docs and the perl docs that [\s\S]* should match zero or more white space and non-whitespace characters.

I was having problems with this RewriteRule because I was trying to put it in my apache conf file (for better performance than .htaccess) but I was getting Bad Request responses. I solved the problem by putting a / before the index.php like so:
Code:
RewriteRule ^([\s\S]*)$ /index.php/$1 [L,NC,QSA]

Seems to be working now. Hope this helps someone else.
Reply
#2

No they were put there because there was a problem with the forward / slash
What did you Try? What did you Get? What did you Expect?

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

(12-09-2020, 09:48 PM)InsiteFX Wrote: No they were put there because there was a problem with the forward / slash
I don't understand what you mean by 'they' ? Can you clarify what you mean here?
Reply
#4

The CodeIgniter 4 Developers, if I remember eight they added that when I was having trouble with
the forward slash on my Windows 10 Pro x64 which fixed the problem.
What did you Try? What did you Get? What did you Expect?

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

(12-10-2020, 02:29 PM)InsiteFX Wrote: The CodeIgniter 4 Developers, if I remember eight they added that when I was having trouble with
the forward slash on my Windows 10 Pro x64 which fixed the problem.

This doesn't clarify your prior statment where you said "they were put there." They in that context could not possibly be referring to the Codeigniter devs. Please explain what you meant.
Reply
#6

The CodeIgniter Developer's put them in there.
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: 12-11-2020, 11:43 AM by sneakyimp.)

(12-10-2020, 09:37 PM)InsiteFX Wrote: The CodeIgniter Developer's put them in there.
I have no idea what you are trying to say in your last 3 comments.
Reply
#8

What don't you understand the CodeIgniter Development Team added that ([\s\S]) to the .htaccess file.
What did you Try? What did you Get? What did you Expect?

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




Theme © iAndrew 2016 - Forum software by © MyBB