[opencms-dev] Append trailing slash to folder URL

Paul-Inge Flakstad flakstad at npolar.no
Fri Nov 5 00:13:50 CET 2010


Hi again Achim,

I guess a "module mod" is out of the question then, so it seems mod_rewrite prevails for now. I just may request the feature, but I doubt funding is an option for us, as we're non-profit and budgets tend to be tight.

I'm aware of using regexes with mod_rewrite, but was considering the odd case where an editor names a folder "my.folder" or something smart like that (which could cause other problems, and in reality should never happen, but you know those editors..!).

Internal links are not the biggest problem, since they are somewhat controllable - like you pointed out. Controlling incoming external links is not as easy.

In fact, this was what got me going in the first place: our internal links now always point to /something/, instead of /something/index.html. But there are still incoming links pointing to the /something/index.html variant, and voila - duplicate content. Handling this specific problem within OpenCms should be trivial (a check and redirect in the template), but the folder problem is a different animal...

The real problem (and I do think it's a problem, albeit not a huge one, I'll admit) is that OpenCms serves the same resource through multiple URLs, and this was the issue I wanted to address. You _can_ work around it, f.ex. with mod_rewrite, but wouldn't it be much more elegant if OpenCms could handle this itself?

Anyway, many thanks for your insight, and have a nice night! :)

All the best,
Paul
________________________________________
Fra: opencms-dev-bounces at opencms.org [opencms-dev-bounces at opencms.org] på vegne av Achim Westermann [achim.westermann at gmx.de]
Sendt: 4. november 2010 23:27
Til: The OpenCms mailing list
Emne: Re: [opencms-dev] Append trailing slash to folder URL

Hi Paul,

you wouldn't need a case for each possible extensions as mod_rewrite
supports regular expressions. You could match (pseudocode)
<anything>/<justletters> for the rewrite to <anything>/<justletters>/
and done.

Regarding doing this within OpenCms.

Option 1) Feature request. Funding (negotiation with Alkacon) will
highly increase the possibility of having this implemented quickly.

Option2) If you are just speaking of inner-page links (those links that
are generated by OpenCms) ensure that your links are correct. Do this by
just allowing editors to enter links by offering XMLContent values of
type OpenCmsVfsLink, OpenCmsVarLink,... .


cheers,
Achim


On 11/04/2010 11:16 PM, Paul-Inge Flakstad wrote:
> Hey Achim,
>
> Thanks! Yeah, you're right about that - and we do indeed use the .html extension, so it is a plausible solution. But wouldn't you have to add rules for all filetype extensions, not just .html? Like .xml, .jpg, .png ...and the list goes on.
>
> I really like the idea of doing this in OpenCms though. (And in my opinion, this should have been the default behaviour of OpenCms, but for some reason it's not.)
>
> Would it be possible to override a request handler or something? Or, generally speaking: could I accomplish what I want in OpenCms through a module, or would I be forced to modify the OpenCms core?
>
> Cheers,
> Paul
>
> ________________________________________
> Fra: opencms-dev-bounces at opencms.org [opencms-dev-bounces at opencms.org] på vegne av Achim Westermann [achim.westermann at gmx.de]
> Sendt: 4. november 2010 22:47
> Til: The OpenCms mailing list
> Emne: Re: [opencms-dev] Append trailing slash to folder URL
>
> Hi Paul,
>
> you could drop having to do it within OpenCms if you are able to
> establish the naming convention of files to have an extension (.html).
>
> kind regards,
> Achim
>
>
> On 11/04/2010 10:29 PM, Paul-Inge Flakstad wrote:
>> Hi Yves,
>>
>> I thought of that (but not very deep), but wouldn't I have to do it in OpenCms, since I'd first need to determine if the requested resource is a folder?
>>
>> Cheers,
>> Paul
>> ________________________________________
>> Fra: opencms-dev-bounces at opencms.org [opencms-dev-bounces at opencms.org] på vegne av Yves Glodt [yg at mind.lu]
>> Sendt: 4. november 2010 22:21
>> Til: The OpenCms mailing list
>> Emne: Re: [opencms-dev] Append trailing slash to folder URL
>>
>> Maybe urlrewrite or mod_rewrite can help you?
>>
>> -
>> Sent from my Android
>>
>> On Nov 4, 2010 5:19 PM, "Paul-Inge Flakstad"<flakstad at npolar.no<mailto:flakstad at npolar.no>>   wrote:
>>> Good evening lads and ladies,
>>>
>>> I'd like to redirect requests to folder resources with no trailing slash to the same URL, but with the trailing slash.
>>>
>>> E.g. a request to
>>> http://www.mysite.com/en
>>> Should be redirected to
>>> http://www.mysite.com/en/
>>>
>>> OpenCms does not do this automagically, and the fact that the same resource is served from both URLs can cause problems in terms of SEO (duplicate content).
>>>
>>> Would appreciate any solutions, or even just a pointer. Can't imagine I'm the first to face this problem. Did I overlook something basic?
>>>
>>> All the best,
>>> Paul
>>>
>>> _______________________________________________
>>> This mail is sent to you from the opencms-dev mailing list
>>> To change your list options, or to unsubscribe from the list, please visit
>>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>

_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list