![]() |
.htaccess and trailing slash - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: .htaccess and trailing slash (/showthread.php?tid=37175) |
.htaccess and trailing slash - El Forum - 12-30-2010 [eluser]sehummel[/eluser] In my config file, I have: Code: $config['url_suffix'] = "/"; Here is my .htaccess: Code: Options +FollowSymLinks When I load a page, I don't get the trailing slash. I am using URI routing, but even when I go to the actual path of the controller/view, I still don't get the trailing slash. What am I doing wrong? I tried removing the slash after the .php in the last line of the .htaccess, but that didn't do it. Even if I add ".html" as my URL suffix, it doesn't get added. And that's not in my .htaccess. .htaccess and trailing slash - El Forum - 12-31-2010 [eluser]Daniel Moore[/eluser] What version of CI? .htaccess and trailing slash - El Forum - 12-31-2010 [eluser]Madmartigan1[/eluser] The suffix will only be appended on urls generated by CI, and is not required. There is not redirect to the suffixed url or anything like that. So, say you are using the "html" extension: /services/networking.html will work /services/networking will also work If you use the anchor() function, pagination, or anything else that generates urls, it should be working. Otherwise, you have to suffix the links yourself. If you want to force the extension, you'll need to do a redirect from your .htaccess .htaccess and trailing slash - El Forum - 12-31-2010 [eluser]sehummel[/eluser] @madmartigan1 -- Does that mean it doesn't work for URIs generated by URI routing. I can't even get it to append .html. If I need to change my .htaccess, can you help me with that, or at least point me in the right direction? I tried to add the trailing slash to a URI in URI routing, but CI didn't like that. .htaccess and trailing slash - El Forum - 12-31-2010 [eluser]Madmartigan1[/eluser] Tell me what exactly it is that you're trying to do? What are you doing? (post your code) What do you expect to happen? What actually happens? (post your output) Be detailed. .htaccess and trailing slash - El Forum - 01-04-2011 [eluser]sehummel[/eluser] The code is above. I'm not sure what I can post. Here is the actual path of my file: domain.com/news Here is the route I want it to have: Code: domain.com/news-and-events/ I can get domain.com/news-and-events by doing: Code: $route['news-and-events'] = "news"; But it breaks when I try to do: Code: $route['news-and-events/'] = "news"; Code: domain.com/news-and-events I get a 404 error with the second route. .htaccess and trailing slash - El Forum - 01-04-2011 [eluser]n0xie[/eluser] Maybe this helps: http://farinspace.com/codeigniter-htaccess-file/ |