![]() |
seo url and routes.php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: seo url and routes.php (/showthread.php?tid=41616) |
seo url and routes.php - El Forum - 05-12-2011 [eluser]Bad Penguin[/eluser] The $route['en'] will match both /en and /en/ leading to duplicated content if someone type or link me with the wrong url how can i match "/en/" url only so i can redirect it to controller "homepage/index/en" and match "/en" so i can redirect it to different controller "redirect/homepage/en" ? Thanks in advance ![]() seo url and routes.php - El Forum - 05-12-2011 [eluser]Krzemo[/eluser] why would you want to redirect to different urls? use .htaccess to solve trailing slash problem seo url and routes.php - El Forum - 05-13-2011 [eluser]Bad Penguin[/eluser] [quote author="Cshamoh" date="1305225765"]why would you want to redirect to different urls? use .htaccess to solve trailing slash problem[/quote] I'm perfectly aware about using mod_rewrite, you didn't understood my problem: i don't need to redirect to different urls. For some reason i've "strange" incoming queries that leads to duplicate pages. As example if my url is: /de/ then for some reason i get spidered for more other urls too: - /de (no trailing slash) - /de.html (because my suffix is .html this will become "de" in codeigniter) - /de/.html (because of my suffix this will become "de") I already used linklint to check my whole URL navigation tree and is not broken. But this is not only the /de/ case, it also apply to /en/category1/tag1/ and any other URL i've. I need codeigniter to respond to exactly only the URLs i've and that i want, perhaps i should remove $config['url_suffic']='.html'; and use regular expressions in routes.php? Or this is a core limitation by design of codeigniter and if i want a more SEO friendly routing system i need to use some different tool? seo url and routes.php - El Forum - 05-13-2011 [eluser]CroNiX[/eluser] I believe this is done by the webserver and it does it to url's that do not have a file extension associated with them because traditionally those are directories. In other words, http://www.yoursite.com/something would be considered a directory where http://www.yoursite.com/something.html wouldn't. If it thinks the url is a directory, it (webserver) tries to add a slash to the end. This isn't unique to CI. A solution is to add this to your .htaccess. It will 301 redirect anything ending in a slash to the same thing without the trailing slash, so that only 1 url will work for each page. Code: RewriteEngine On seo url and routes.php - El Forum - 05-17-2011 [eluser]Bad Penguin[/eluser] [quote author="CroNiX" date="1305329484"]page. Code: RewriteEngine On As i wrote, this does not solve anything, it still generated duplicated page when .html extension is added and C.I. generates the same duplicated page. seo url and routes.php - El Forum - 05-17-2011 [eluser]pickupman[/eluser] [quote author="Bad Penguin" date="1305224112"]The $route['en'] will match both /en and /en/ leading to duplicated content if someone type or link me with the wrong url how can i match "/en/" url only so i can redirect it to controller "homepage/index/en" and match "/en" so i can redirect it to different controller "redirect/homepage/en" ? Thanks in advance ![]() Have you tried: Code: $route['en/'] = 'redirect/homepage/en'; |