![]() |
Hello. I just posted a new "tutorial" about having "truly" SEO urls - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: External Resources (https://forum.codeigniter.com/forumdisplay.php?fid=7) +--- Forum: Learn More (https://forum.codeigniter.com/forumdisplay.php?fid=15) +--- Thread: Hello. I just posted a new "tutorial" about having "truly" SEO urls (/showthread.php?tid=64765) |
Hello. I just posted a new "tutorial" about having "truly" SEO urls - Avenirer - 03-23-2016 Hello, CI community. A lot of people asked about having SEO friendly URLs, and even though we can set translate_uri_dashes to TRUE inside the routes.php, we still have a problem with "duplicate content", as urls with underscores still work at the same time as the urls with dashes. This tutorial, is not really a tutorial, but is a good way to invite people to look inside the CodeIgniter code. If anyone has another solution, or if my solution is bad, please do tell me. Thank you. http://avenir.ro/how-to-make-truly-seo-urls-in-codeigniter-without-duplicate-content-on-underscore-urls/ RE: Hello. I just posted a new "tutorial" about having "truly" SEO urls - PaulD - 03-23-2016 Hi, Interesting post - thanks. As I was reading it and you got to the bit about Quote:Then how do save ourselves from this SEO Armageddon? Well… Let us take a look at the Router.php inside the system/core. I though, "oh no, don't start fiddling about with the core". And then as I pondered through the code, still muttering to myself I got to: Quote:So, this is the culprit… But what now? Should we simply modify it? No… NEVER MODIFY THE SYSTEM FILES IN CODEIGNITER! That made me chuckle. A very well written post. I might give it a test with a small site sometime but doesn't having a canonical link on all your pages sort out all that SEO 'repeated content' problems anyway? Best wishes, Paul. RE: Hello. I just posted a new "tutorial" about having "truly" SEO urls - nguyenanhnhan - 03-23-2016 Hello, Thank you for sharing , In the code has some problems when applied . Eg: base ( ' auth / edit_user / 1 ' ) --- > real url : localhost / authedit-user not "/" and parameter I think you should add a few lines of code : line 54 : Code: $url .= str_replace( '_' , '-' , $segments[0] . '/'); and Code: if (count($segments) > 2) RE: Hello. I just posted a new "tutorial" about having "truly" SEO... - skunkbad - 03-23-2016 I never like doing something with PHP that the server can do better. If you are on an Apache server with mod_rewrite enabled: Code: RewriteRule ^(.*)_(.*)$ $1-$2 [N,E=redirect:true] By doing this you will just have a single redirect at the server level, and if CodeIgniter can't route to the URL it will just 404. No core extensions required. Credit: https://www.geoffhayward.eu/2014/04/character-replace-with-apache-module-mod-rewrite RE: Hello. I just posted a new "tutorial" about having "truly" SEO urls - Avenirer - 03-24-2016 (03-23-2016, 08:32 PM)nguyenanhnhan Wrote: Hello, Thank you for looking at it. I just changed it. I usually do tutorials on fresh installs and I didn't think of testing it on something else than the Welcome controller ![]() RE: Hello. I just posted a new "tutorial" about having "truly" SEO... - Avenirer - 03-24-2016 (03-23-2016, 09:46 PM)skunkbad Wrote: I never like doing something with PHP that the server can do better. If you are on an Apache server with mod_rewrite enabled: That is an interesting idea. Does it also work on the second segment of a url? RE: Hello. I just posted a new "tutorial" about having "truly" SEO urls - Avenirer - 03-24-2016 (03-23-2016, 06:21 PM)PaulD Wrote: Hi, The most important part in learning is the road ![]() |