CodeIgniter Forums
Remove index segment from url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Remove index segment from url (/showthread.php?tid=64557)



Remove index segment from url - scion - 03-04-2016

Hello!

Imagine we have Controller 'Test" with method 'index'

So it will be accessed in two way 'test/index' and just 'test', so we have duplicate content by same URL

Any suggestions?

Thanks!


RE: Remove index segment from url - keulu - 03-04-2016

this is the "normal way"
but www.exemple.com/test and www.exemple.com/test/index is not the same url...

if you don't want "test/index" and "test" respond to the same method, don't use index.


RE: Remove index segment from url - RobertSF - 03-04-2016

I suppose you could use a test in the method to reject calls that did not explicitly include "index," but why? What is the problem caused by duplicate content by the same URL?


RE: Remove index segment from url - PaulD - 03-04-2016

If the problem is one of duplicate content for SEO, you should use a canonical link in your page head to tell search engines which url you want the page to be recognized as.
https://support.google.com/webmasters/answer/139066?hl=en


RE: Remove index segment from url - arma7x - 03-04-2016

Just customize route.php in config folder.


RE: Remove index segment from url - scion - 03-05-2016

Thanks guys for all answers!

So right decision would be use canonical link if we present on page with index in URL that point to page without index

or

make some redirect rules from index to without

or even set 404 error for test/index!