Niraj Chauhan
Niraj Chauhan

Reputation: 7900

Codeigniter hide URL segments

I am new to codeigniter, is it possible to hide some segments in URL but need them inside controller, I know this might be a stupid question but for SEO I need to know.

My current URL:

http://mysite.com/mobiles/smartphone/iphone-5/1534

Now here mobiles is my controller, smartphone is my function within mobiles controller, iphone-5 is the product name(just for SEO purpose) and the last 1534 is the ID which I need for SQL query

Is it possible to get this kind of URL

http://mysite.com/mobiles/smartphone/iphone-5/

Here the main ID is not present in URL but in controller when I do $this->uri->segment(4) can I get that ID.

In simple words I just want to hide the ID from URL for SEO

Upvotes: 0

Views: 1731

Answers (1)

Furkat U.
Furkat U.

Reputation: 451

The answer is no, you cannot do this, because codeigniter reads segments from browser URI. For such cases there is alias/slug. It is uniquely identification of each posts by aliasing/slugging title of the post e.g. The New Iphone 6 Released = the-new-iphone-6-released etc.

Upvotes: 1

Related Questions