trailing slash or no trailing slash, thats the question

Permalink
Hi everyone

I have a site that when loaded the url contains a trailing slash

http://www.mydomain.co.uk/

If i navigate to another link (pretty urls enabled) and then clcikt he enabled "Home" link, it tries to return me tohttp://www.mydomain.co.uk

Notice the missing trialing slash.

I cannot find any way whatsoever to explicity set the trailing slash, or in fact remove it. There seems to be no site.php, config.php in the file directories nor is there anything editable (that I can see) in the database???

Am I missing something. Has C5 taken away the ability to edit details such as this? I'vce noticed a file called "hide_config_files.php", which is great in theory, but editing this file to exclude those hidden files seems to do nothing whatsoever, so I guess I'm missing something there too?

Appreciate your time, efforts and any suggestions.

Tony

DigitalCrate
View Replies: View Best Answer
andrew replied on at Permalink Best Answer Reply
andrew
If you add concrete.php to your application/config/ directory, and in it place this:

<?php
return array(
    'seo' => array(
        'trailing_slash' => true
    )
);


That should enable the trailing slash for your URLs.
andrew replied on at Permalink Reply
andrew
FYI: looks like there's a bug with redirections when this is enabled. If you go to a URL without a trailing slash you get stuck in a redirect loop. I've fixed this in github but just wanted to post about it.
DigitalCrate replied on at Permalink Reply
DigitalCrate
Apologies, your github change fixed the issue :)
DigitalCrate replied on at Permalink Reply
DigitalCrate
Hi Andrew

All of a sudden, if I navigate to the Sitemap section and click on a page link, choose "Attributes", this error appears in a modal window?

{"error":{"message":"The identifier fID is missing for a query of Concrete\\Core\\File\\File"},"errors":["The identifier fID is missing for a query of Concrete\\Core\\File\\File"]}

This has only happened since I modified the files as per the git files corresponding to this discussion. Any ideas?
DigitalCrate replied on at Permalink Reply
DigitalCrate
Thats great many thanks, worked like a charm.
DigitalCrate replied on at Permalink Reply
DigitalCrate
Actually, what this does is makes the front end work but then seems to get the backend stuck in a loop instead?
DigitalCrate replied on at Permalink Reply 1 Attachment
DigitalCrate
Hi

Just found that this seems to throw another issue now. With the concrete.php fil in place the homepage button includes the "/", thats great, however, the Sitemap page in the dashboard now throws an error (see attached), the file manager does nothing either. So we have fixed the front end but caused bigger issues in the backend. Any thoughts?
andrew replied on at Permalink Reply
andrew
I think this config value isn't quite ready for prime time. The problem is that all the links to pages honor it and honor it pretty well, but none of the AJAX links or routes have trailing slashes. So when they get navigated to, they redirect to the trailing slash version. This makes all AJAX requests take longer and sometimes they break. I think the easiest and best way to fix this is if the current request doesn't match the trailing slash settings, only redirect to the alternate version of the page (with or without the trailing slash) if the we're actually _on_ a page.
andrew replied on at Permalink Reply
andrew
I thought this would be more difficult but I believe I have a fix for this checked into github that looks to be improving performance and I haven't gotten any of those errors you've mentioned. The redirection only takes place when a valid page is loaded but the current config settings and the current URL trailing slash don't match.