How can I add a trailing slash to TYPO3 v9 URLs?

后端 未结 4 551
庸人自扰
庸人自扰 2021-01-31 22:51

When updating from TYPO3 8.7 to TYPO3 9.5 you might drop the realurl extension in favor for the new routing feature.

But you might notice, that realurl appended a / to a

4条回答
  •  我在风中等你
    2021-01-31 23:08

    Additional to the answer from Tim Schreiner, i made a condition in the .htaccess file, which redirects urls whithout slashes to the url with trailing slash. Files should not be affected by this condition. Following condition did i add to the .htaccess file:

    # EXTRA: Enforce trailing slash. Ignore trailing slash on file endings 
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteCond %{REQUEST_FILENAME} !\.(gif|jpg|png|jpeg|css|js|xml|rss|txt)$ [NC]
    RewriteCond %{REQUEST_URI} !\.(gif|jpg|png|jpeg|css|js|xml|rss|txt)$ [NC]
    RewriteRule ^(.*[^/])$ /$1/ [L,R=301]
    

提交回复
热议问题