After two sunny weeks of vacation in Tuscany, i’d like to implement related items and need some help.
Three pieces of information:
- I’m using the latest version of Elements
- I’m using Pretty URLs
- I’m using IIS, not Apache
This is my web.config (similar to the .htaccess file)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!-- 0) Fallback: / oder /index.php ohne item= - Redirect -->
<rule name="ohne item oder slug - redirect" stopProcessing="true">
<match url="^(|index\.php)$" ignoreCase="true" />
<conditions>
<!-- nur wenn KEIN item=… gesetzt ist -->
<add input="{QUERY_STRING}" pattern="(?:^|&)item=" negate="true" />
</conditions>
<!-- Hier Ziel-URL eintragen -->
<action type="Redirect" url="/" redirectType="Permanent" />
</rule>
<!-- 1) index.php?item=slug → /slug (Rewrite) -->
<rule name="?item=slug → slug" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{QUERY_STRING}" pattern="(?:^|&)item=([^&]+)" />
</conditions>
<action type="Rewrite" url="index.php?item={C:1}" />
</rule>
<!-- 2) /slug → index.php?item=slug -->
<rule name="slug → index.php?item=slug" stopProcessing="true">
<match url="^([^/]+)/?$" ignoreCase="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?item={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
This is my site structure:
From the main page, all articles are correctly linked and displayed on the /articles/ page. Related items are displayed on each /articles/ page. I’ve specified the link using {{ item.url }}. However, it’s not being rendered/translated correctly:
https://www.cornrow.de/artikel/herr_grun_zieht_nach_lich/?item=unser_d-wurf_ist_da
The correct link should be:
https://www.cornrow.de/artikel/unser_d-wurf_ist_da
If i try the preview it works.
