Friday, May 27, 2022
  • Home
  • Event
  • Technology
  • Program
  • Education
No Result
View All Result
E-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
4
VIEWS
Share on FacebookShare on Twitter

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

Related Posts

Just How Long Should Alt Text Be? | CSS-Tricks

Beautify GitHub Profile | CSS-Tricks

Cool CSS Hover Effects That Use Background Clipping, Masks, and 3D | CSS-Tricks

Customizing Color Fonts on the Web | CSS-Tricks

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

Technology

Robotic exoskeleton startup wins Oregon life and biosciences angel competition – GeekWire

by admin
May 27, 2022
0

Biomotum’s SPARK device for rehabilitation of individuals with cerebral palsy, stroke, and other neurological conditions. (Biomotum Photo) Wearable robotics startup...

Read more

Robotic exoskeleton startup wins Oregon life and biosciences angel competition – GeekWire

Seattle startup JetClosing, which launched in 2016 to digitize home closing process, is shutting down – GeekWire

Seattle University aims to boost entrepreneurship – GeekWire

Fishery monitoring software wins $25K at Univ. of Washington student startup competition – GeekWire

Elizabeth Scallon departs Amazon for HP; Fauna hires marketing exec; and more – GeekWire

Just How Long Should Alt Text Be? | CSS-Tricks

Load More

Popular Posts

Best Winter Olympics Activities for Kids in the Classroom

by admin
January 19, 2022
0

What is Packet Sniffing Attack? – Types and How to Prevent It?

by admin
December 11, 2021
0

Zain Nadella, 1996-2022: Microsoft CEO’s son remembered for love of music, bright smile, profound impact on his dad

by admin
March 1, 2022
0

Copyright © 2021 - e-Capitals.com 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.com - DESIGNED AND DEVELOPED BY TEAM WORDPRESS BLOGX