CodeIgniter 3.0 gives 404 on space in URL

304 Views Asked by At

If I have a URL like this:

http://localhost/Cool Website/

I will get this error:

404 Page Not Found: The page you requested was not found: Cool Website/index

However, when I use underscores like http://localhost/Cool_Website/

CodeIgniter loads as intended. This issue is now manifesting itself after pasting the CodeIgniter folder as a subfolder into our main project which has spaces in its name that I cannot change. (I can and have changed the CodeIgniter project's name to use underscores)

Is there a workaround for this?

Update: solved my issue by changing system files. I am running php 5.3.13.

I went to the URI core file and put this in the _parse_request_uri:

$uri = str_replace('%20', ' ', $uri);

At line 206, after $uri = isset($uri['path']) ? $uri['path'] : '';

This seems to have fixed it. I reverted the change to QUERY_STRING in my config file because QUERY_STRING was empty. This may be a CodeIgniter 3.0 bug. My guess is the 20% wasn't being "considered valid" by the uri code, so changing it back to a real space made it work again as it truly is the proper URL.

0

There are 0 best solutions below