Welcome Guest, Not a member yet? Register   Sign In
URL question
#1

Good day for everyone! I have a bit dumb question. Imagine, we have controller

PHP Code:
class Test {

     public function 
index()
     {
          echo 
'Some page';
     }

     public function 
page()
     {
          echo 
'Some page 2';
     }



So i can call index by url like test/index or i can set routing for that $route['test'] = 'test/index';

So we have that one page(content) have two links! test and test/index and if i write them to address bar result page will the same. So common question is how handle this kind of situations?

For example, maybe i need check in index method do i have second segment equal 'index' and redirect to just 'test' or something?

PHP Code:
public function index()
{   
     if(
$this->uri->segments(2) === 'index'redirect('test');


How do you handle stuff like this? I think this is all about SEO and so on, what would be the best?
Reply


Messages In This Thread
URL question - by scion - 10-08-2015, 04:59 AM
RE: URL question - by mwhitney - 10-08-2015, 07:51 AM
RE: URL question - by scion - 10-08-2015, 08:12 AM
RE: URL question - by mwhitney - 10-08-2015, 08:27 AM
RE: URL question - by scion - 10-08-2015, 09:09 AM
RE: URL question - by scion - 10-08-2015, 04:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB