Welcome Guest, Not a member yet? Register   Sign In
Problems with spaces and in the URL

Hi Guys.

I have a little problem and want to figure out if this is a codeigniter problem.

I have programmed an app.
I have services in a database and want to access a service (viewing details of it) by passing the service name via url (as an normal codeigniter paramter) like:
http://my.domain.com/index.php/controller/function/My Service Name

Normally I want to put the Service Name url-encoded like:
http://my.domain.com/index.php/controller/function/My% 20Service% 20Name

For this I use the php function rawurlencode:

But what I get from codeigniter (or apache, I donĀ“t really know) is a url like above without encoded spaces:
http://my.domain.com/index.php/controller/function/My Service Name

When I type in a URL with "% 20" for a space I get the site and in the URL I see it not encoded.
I never saw this before when working with codeigniter.
So I want to ask you if you have also something of these problems and if this is a codeigniter behaviour (and when: can I change it and where?) or the problems source somewhere else?

Thanks for your suggestions! Smile


Sorry I forgot to put a space after each '%' because the board softwaer converts "% 20" (without space) into a normal space. Now you can see my problem. Smile

for your problem there are two solutions if you are making database driven menu then replace space with url helper function - or _ like

when getting parameter

srt_replace('_',' ',$title);
here you can see doc http://ellislab.com/codeigniter/user-gui...elper.html

second create column name seo_url in your table and save title in table with same way how your are making in menu then you can directly use that column value in url and take that parameter for query.

Theme © iAndrew 2016 - Forum software by © MyBB