Answer the question
In order to leave comments, you need to log in
How to remove double trail slash in CodeIgniter?
I noticed that on my site which is on CI there is such a problem:
there is a foo controller, the
site.ru/foo/bar.html link leads
to it, but you can also access it through
site.ru // foo/bar.html
how to make the second the address gave 404?
Answer the question
In order to leave comments, you need to log in
1. There is an opinion that in canonical it is better to write an absolute link along with the domain
2. We made a rather "stupid" solution in each controller:
$app->vars->seo->canonical = ... ; //определяем ссылку
...
if (isset($app->vars->seo->canonical) && ($_SERVER['REQUEST_URI'] != $app->vars->seo->canonical) )
{
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$app->vars->seo->canonical);
die();
}
You don’t need to worry about it at all, just indicate the path of the page in the canonical meta tags, and everything will be fine with you.
Here is the first thing I found about this: moz.com/blog/canonical-url-tag-the-most-important-...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question