Wednesday, May 25, 2022
  • Home
  • Event
  • Technology
  • Program
  • Education
No Result
View All Result
i-Capitals
No Result
View All Result
Home Program

Trailing Slashes on URLs: Contentious or Settled? | CSS-Tricks

admin by admin
February 25, 2022
in Program
0
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter

A fun deep dive from Zach. Do you have an opinion on which you should use?

Related Posts

Mastering SVG’s stroke-miterlimit Attribute | CSS-Tricks

First Look At The CSS object-view-box Property | CSS-Tricks

Dialog Components: Go Native HTML or Roll Your Own? | CSS-Tricks

Quick Guide to Building an ETL Pipeline Process

1) https://website.com/foo/
2) https://websites.com/foo

The first option has a “trailing slash.” The second does not.

I’ve always preferred this thinking: you use a trailing slash if that page has child pages (as in, it is something of a directory page, even if has unique content of its own). If it’s the end-of-the-line (of content), no trailing slash.

I say that, but this very site doesn’t practice it. Blog posts on this site are like css-tricks.com/blog-post/ with a trailing slash and if you leave off the trailing slash, WordPress will redirect to include it. That’s part of the reason Zach is interested here. Redirects come with a performance penalty, so it’s ideal to have it happen as infrequently possible.

Performance is one thing, but SEO is another one. If you render the same content, both with and without a trailing slash, that’s theoretically a duplicate content penalty and a no-no. (Although that seems weird to me, I would think Google would smart enough not to be terribly concerned by this.)

Where resources resolve to seems like the biggest deal to me. Here’s Zach:

If you’re using relative resource URLs, the assets may be missing on Vercel, Render, and Azure Static Web Apps (depending on which duplicated endpoint you’ve visited).

<img src="https://css-tricks.com/trailing-slashes-on-urls-contentious-or-settled/image.avif"> on /resource/ resolves to /resource/image.avif

<img src="https://css-tricks.com/trailing-slashes-on-urls-contentious-or-settled/image.avif"> on /resource resolves to /image.avif

That’s a non-trivial difference and, to me, a reason the redirect is worth it. Can’t be having a page with broken resources for something this silly.

What complicates this is that the site-building framework might have opinions about this and a hosting provider might have opinions about this. As Zach notes, there are some disagreements among hosts, so it’s something to watch for.

Me, I’d go with the grain as much as I possibly could. As long as redirects are in place and I don’t have to override any config, I’m cool.


Direct Link →

Next Post

Review risks, focus on response plans: Security experts offer tips to prep for Russian cyberattacks

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Popular Posts

Event

Trade Show Booths: 100 Best Ideas for 2022

by admin
May 25, 2022
0

Skift Take Boring trade show booths don’t attract visitors and they certainly don’t help sales. But coming up with new...

Read more

Trade Show Booths: 100 Best Ideas for 2022

Doing Hybrid Events Right Is Hard: Top CES Official

Best Outdoor Science Activities and Projects That Are Fun and Engaging

Best Short Stories for Middle Schoolers, As Chosen by Teachers

I Worked at a “No Excuses” Charter School and Here’s What I Know Now

Has Amazon found its fourth pillar? Revisiting a key question for the company’s future – GeekWire

Load More

Popular Posts

7 Things the Best Instructional Coaches Do, According to Teachers

by admin
April 26, 2022
0

JSON Minify Online – The Crazy Programmer

by admin
December 11, 2021
0

2021 Game Awards: Everything you need to know from the annual gaming showcase

by admin
December 11, 2021
0

Copyright © 2021 - i-Capitals.news DESIGNED AND DEVELOPED BY TEAM WORDPRESS BLOGX

No Result
View All Result
  • Home
    • Home 1
    • Home 2
    • Home 3
  • Event
  • Technology
  • Program
  • Education

Copyright © 2021 - e-capitals.news - DESIGNED AND DEVELOPED BY TEAM WORDPRESS BLOGX