• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I can access to one site by few different URLs

#1
Hey, I've started learning codeigniter few weeks ago. I found one thing which is important to me, and I really don't know how to fix it.

I always pay attention to SEO, and i discovered that in Codeigniter often we can access to one site by few different URLs, like in this exapmle:

For this site: https://codeigniter.com/en/community

1. With adding index.php before the controller name -  https://codeigniter.com/index.php/en/community

2. When we've declared our route, users still can access by default path. I know user firstly need to know that, but it's still not good enough for me.

Do you know how can I handle this issues?
Reply

#2
(09-20-2019, 05:33 AM)mk27 Wrote: I always pay attention to SEO, and i discovered that in Codeigniter often we can access to one site by few different URLs, like in this exapmle:

For this site: https://codeigniter.com/en/community

Do you know how can I handle this issues?

Try this link and read the Google recommendations:


https://support.google.com/webmasters/an...9066?hl=en
download and make your system directory strict
Reply

#3
(09-20-2019, 05:51 AM)John_Betong Wrote: Try this link and read the Google recommendations:


https://support.google.com/webmasters/an...9066?hl=en

Thanks! Thats interesting, and im a little less afraid now, but if you know how to redirect those pages to main, defined route, I would appreciate it.
Reply

#4
(09-20-2019, 06:21 AM)mk27 Wrote:
(09-20-2019, 05:51 AM)John_Betong Wrote: Try this link and read the Google recommendations:


https://support.google.com/webmasters/an...9066?hl=en

Thanks! Thats interesting, and im a little less afraid now, but if you know how to redirect those pages to main, defined route, I would appreciate it.

I pass the required Controller's $data['canonical'] to the view and echo $canonical
PHP Code:
// Controller
$data['canonical']  strtolower($this->uri->uri_string()); // 'quotations';

// View
<link rel="canonical" href="<?= base_url($canonical); ?> "

The above script has not been tested but you should get the general idea. It depends if you are using "Pretty Urls" or just index.php.

Try the script and test it with all URL variations. the canonical link should be identical in every case.
download and make your system directory strict
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.