Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I finally figure out how do not have duplicate urls parsing.</p> <p>First of all in config.php remove the suffix, better never user it: $config['url_suffix'] = '';</p> <p>Then in routes.php never use wildcards and always uses regular expression.</p> <p>I.e, if i use: $route['(:any)/(:num)'] = 'homepage/parser/$1/$2'; this will work for all the following urls:</p> <pre><code>/a/10 /a/10/11 /a/10/11/12 </code></pre> <p>and so on!</p> <p>Instead:</p> <pre><code>$route['([\w_-]+)/(\d+)'] = 'homepage/parser/$1/$2'; </code></pre> <p>this only work for</p> <pre><code>/a/10 </code></pre> <p>and:</p> <pre><code>$route['([\w_-]+).html'] = 'homepage/parser/$1'; </code></pre> <p>will only work if you URLs really end in .html</p> <p>Unlucky /a/10.html/ is still a duplicate, so, i need at least one .htaccess rule to remove trailing slashes from URLs</p> <p>I really need unique URLs so i think i'm dropping any future codeigniter development for this project where i've mixed url: 1) .html 2) directories 3) old dynamic urls</p> <p>Instead i figure out that for SEO purpouse probably is the best to: - only use pages without extensions - avoid any directories</p> <p>So if this is the case (another project of mine), i just use plain URLs in my code and regular expressions in routes.php.</p> <p>The only issues is the trailing slash duplicate problem but this can be avoided globally with this .htaccess from this other solution: <a href="https://stackoverflow.com/questions/4167539/remove-trailing-slash-using-htaccess-except-for-home-landing-page">Remove trailing slash using .htaccess except for home / landing page</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload