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


Messages In This Thread
mistake in default .htaccess file? - by sneakyimp - 12-09-2020, 04:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB