Welcome Guest, Not a member yet? Register   Sign In
Make anchor() generate URLs with trailing slash
#1

[eluser]SeasonedCoder[/eluser]
I have this problem:

any time I ask anchor() to generate a url with a trailing slash like

Code:
anchor('malls/', 'Malls');

it generates a url without slash. Is there any way to customize this behavior?

Of course, I can put this url manually, but I would prefer anchor() to do it for me Smile
#2

[eluser]Jelmer[/eluser]
Try setting this in your application/config/config.php file:
Code:
$config['url_suffix'] = "/";
#3

[eluser]Colin Williams[/eluser]
Why is this important? If you are worried about Apache redirecting to a URI with a forward slash, don't. It doesn't happen. As far as Apache is concerned, index.php is handling the request.
#4

[eluser]SeasonedCoder[/eluser]
@Jelmer

Thanks for the trick!

@Colin Williams

Actually, I for one prefer URLs without trailing slash. But the person I'm making a site for wants his URLs to end either with .html or slash. So, somehow I have to handle this.
#5

[eluser]oddman[/eluser]
Time to slap the person who wants that - it's a ridiculous request, means absolutely nothing.
#6

[eluser]SeasonedCoder[/eluser]
Yes, I agree, but still feel reluctant to slap him Smile
#7

[eluser]oddman[/eluser]
[quote author="SeasonedCoder" date="1240398277"]Yes, I agree, but still feel reluctant to slap him Smile[/quote]

Well, it is of course a proverbial slap Tongue

I'd hate to know what this client is like if they're worried about URL slashes...
#8

[eluser]SeasonedCoder[/eluser]
Doesn't look like a newbie, but still...




Theme © iAndrew 2016 - Forum software by © MyBB