Welcome Guest, Not a member yet? Register   Sign In
Pretty URLS and trailing slashes
#1

[eluser]Unknown[/eluser]
Hi,

I'm new to CI and have recently converted my old ASP site (BOOOOO) into CI (YAY!) and I have to admit I found it very simple to do and fairly painless.

I'm left with one little issue though, for some reason on a few URLs on my site I get a trailing slash and I can't seem to get rid of it, odd thing is though this slash only seems to appear on index pages on my site which are serving dynamic content.

I know this problem of trailing slashes has been posted many times before, as I have spent about 2 days looking for a solution, but each one i try doesn't seem to work.

I'm figuring this is some kind of routing or .htaccess issue but I'm not able to track down the problem.

Just to let people know where I am at...

I have built my application and moved my system folder out of htdocs for security purposes and then adjusted index.php accordingly.

My views folders are set up like so...

views
- blog
- index.php
- article.php
- some_photos
- index.php
- photo.php

In my routes.php I have rules like the following

Code:
$route['blog/:num'] = "blog/index";
$route['blog/:any/:num'] = "blog/article";

$route['some-photos'] = "some_photos";
$route['some-photos/:any/:num'] = "some_photos/photo";

My .htaccess file has the following rules:

Code:
RewriteEngine On

RewriteCond $1 !^ (index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ /index.php/$1 [L]

I can't for the life of me work out where I am going wrong!

By using fixes I have found on the net such as this one:
Removing Trailing Slashes From Your URL

I can get the following kind of result:
www.sitehere.com/blog/index.php/blog
Which removes the slash on the urls I want them gone from but it adds back in index.php which I really don't want.

Can anyone help or has anyone else come across this problem?

I am guessing the only other thing I can do is to force every url to have a trailing slash but this isn't something I really want to do if I can help it.

Thanks in advance


Messages In This Thread
Pretty URLS and trailing slashes - by El Forum - 08-03-2009, 09:27 AM
Pretty URLS and trailing slashes - by El Forum - 08-03-2009, 10:46 AM
Pretty URLS and trailing slashes - by El Forum - 08-03-2009, 03:00 PM
Pretty URLS and trailing slashes - by El Forum - 08-03-2009, 03:25 PM
Pretty URLS and trailing slashes - by El Forum - 08-04-2009, 03:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB