Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2021-01-20 22:52:38

ar
Member
From: Nuremberg, Germany
Registered: 2012-03-08
Posts: 45
Website

Re: Let Textpattern accept URLs with trailing slash?

Ok but how do I “internally remove” trailing slashes? Are you referring to mod_rewrite or are you recommending to use the /title URL scheme and refrain from using trailing slashes when linking to individual articles?

Offline

#26 2021-01-20 22:55:53

ar
Member
From: Nuremberg, Germany
Registered: 2012-03-08
Posts: 45
Website

Re: Let Textpattern accept URLs with trailing slash?

Do I understand correctly: No longer use R=301 in mod_rewrite in order to not change the address bar, learn how to remove trailing slashes in mod_rewrite (“internally”), and use canonical links in order to prevent getting the content rated as duplicate (because we are no longer using R=301)?

Last edited by ar (2021-01-20 22:58:38)

Offline

#27 2021-01-20 22:59:45

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Let Textpattern accept URLs with trailing slash?

ar wrote #328287:

Ok but how do I “internally remove” trailing slashes?

With something like

RewriteRule ^(.*)/$ /$1 [L]

but many sites explain it much better than me.

Are you referring to mod_rewrite or are you recommending to use the /title URL scheme and refrain from using trailing slashes when linking to individual articles?

Both should work, just remove the slash-adding rule from your .htaccess to try.

Offline

#28 2021-01-20 23:01:29

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Let Textpattern accept URLs with trailing slash?

ar wrote #328288:

Do I understand correctly: No longer use R=301 in mod_rewrite in order to not change the address bar, learn how to remove trailing slashes in mod_rewrite (“internally”), and use canonical links in order to prevent getting the content rated as duplicate (because we are no longer using R=301)?

Quite right imo, but I may be wrong.

Offline

#29 2021-01-20 23:12:58

ar
Member
From: Nuremberg, Germany
Registered: 2012-03-08
Posts: 45
Website

Re: Let Textpattern accept URLs with trailing slash?

Thank you very much, I will try it out. :-)

Offline

#30 2021-01-21 07:09:42

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Let Textpattern accept URLs with trailing slash?

ar wrote #328282:

Ok I guess that my “messy” page code is the best I can do in this case:

  • Deliver a specific ID as front page article (in my example id=2)

Check github.com/colak/neme/blob/master/pages/about.tpl#L200 and github.com/colak/neme/blob/master/forms/search_results.tpl#L5

  • Deliver specific articles as “landing page” by assigning a “landingpage”-category (in my example called “overview”) when URL is /section

github.com/colak/neme/blob/master/pages/projects.tpl#L204

  • Deliver everything else as regular articles but have the need to use /section/article URL.

If you have the section/category/title url pattern, this will not be possible, but it is possible if you use the section/title one.

There was a big discussion some time ago about how these url patterns should work. In my view, if you use categories, they should be reflected in the site’s tree so

  • /products/
  • /products/paints/
  • /products/paints/acrylic

makes a semantic sense but

  • /products/acrylic

does not as acrylic could refer to something which might not be a paint.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#31 2021-01-21 09:03:37

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Let Textpattern accept URLs with trailing slash?

ar wrote #328292:

Thank you very much, I will try it out. :-)

You are welcome, please let us know how it works. It would be a good mod_rewrite tip.

Offline

Board footer

Powered by FluxBB