CodeIgniter Forums
Make anchor() generate URLs with 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: Make anchor() generate URLs with trailing slash (/showthread.php?tid=17963)



Make anchor() generate URLs with trailing slash - El Forum - 04-21-2009

[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


Make anchor() generate URLs with trailing slash - El Forum - 04-21-2009

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



Make anchor() generate URLs with trailing slash - El Forum - 04-21-2009

[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.


Make anchor() generate URLs with trailing slash - El Forum - 04-21-2009

[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.


Make anchor() generate URLs with trailing slash - El Forum - 04-22-2009

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


Make anchor() generate URLs with trailing slash - El Forum - 04-22-2009

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


Make anchor() generate URLs with trailing slash - El Forum - 04-22-2009

[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...


Make anchor() generate URLs with trailing slash - El Forum - 04-22-2009

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