question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preview not working with remove trailing slash

See original GitHub issue

Preview not working when removing trailing slashes via web.config:

<rule name="Remove trailing slash" stopProcessing="true">
	<match url="(.*)/$"/>
	<conditions>
		<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
		<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
	</conditions>
	<action type="Redirect" redirectType="Permanent" url="{R:1}"/>
</rule>

PR incoming

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
kjaccommented, Sep 10, 2019

@jveer Disclaimer: I haven’t tested the PR, I just wanted to add some context to it.

If it works it’s all good 👍 but it’s not up to me to decide if it should be merged or not, that’s up to @nul800sebastiaan and the PR team.

For future reference, here’s how one could do a rewrite rule that doesn’t affect the backoffice:

<rule name="RemoveTrailingSlashRule" stopProcessing="true">
  <match url="(.*)/$" />
  <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
    <add input="{URL}" pattern="^/(?:layout|umbraco|install|template)(?:/.*)?$" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  </conditions>
  <action type="Redirect" url="{ToLower:{R:1}}" redirectType="Permanent" />
</rule>

0reactions
nul800sebastiaancommented, Nov 13, 2019

Additional note, if this is going to get traction in the future: this also needs testing with Umbraco being installed in a virtual directory, not sure if that affects anything in the related PR, but it is something that would need to be added to the test matrix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

apache - Remove trailing slashes
The solution to this subtle problem is to let the server add the trailing slash automatically. To do this correctly we have to...
Read more >
How to remove trailing slash in Umbraco 8
It is really easy to disable this behaviour and remove the trailing slash from the URLs. Simply edit your umbracoSettings.config file which can ......
Read more >
How to use a trailing slash in URLs correctly
To do this, you can create a new filter with a clear name such as “Removing Trailing Slash.” Select “Custom,” then “Advanced.” In...
Read more >
Remove trailing slash
I need to remove any trailing slashes off any url that come in. www.mydomain.com/category/ - -> www.mydomain.com/category.
Read more >
301 Redirects using trailing slashes not working - General
We currently have an issue with trailing slashes not redirecting (convention is to not include the trailing slash anyways). If you remove the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found