0

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

3
  • What if you make the url like iphone-5---1534 in your controller just explode by --- Commented Jul 9, 2013 at 18:14
  • that makes a bad URL for SEO, I just want I PHONE 5 on url with class name and function name Commented Jul 9, 2013 at 18:25
  • I think but i am not sure that this requirement cannot be achieved Commented Jul 9, 2013 at 18:45

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.