# Standardize letter case and trailing slashes

- Check 02.11 · Architecture and navigation · Critical
- Source: https://checklist-seo-geo.com/en/architecture-navigation/standardize-letter-case-trailing-slashes
- Pick a single URL form (lowercase, with or without a trailing slash) and 301-redirect every variant on Apache, Nginx, IIS, Cloudflare, WordPress or Next.js.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/architecture-navigation/standardize-letter-case-trailing-slashes.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

For Google, `/Blog/Mon-Article`, `/blog/mon-article` and `/blog/mon-article/` are three different URLs. If they all display the same page, the site creates duplicates. The check consists of choosing a single form (in practice: everything lowercase, and a fixed rule for the trailing slash), then 301-redirecting every variant to that form. Once done, only one variant returns a 200; the others redirect to it in a single hop.

## Why it matters

Google's documentation on URL structure is clear: URLs are case-sensitive, `/APPLE` and `/apple` are distinct, and if the server treats them the same way, you should stick to a single case. As for the trailing slash, Google treats `/foo` and `/foo/` as two distinct URLs; only the domain root (`https://example.com` and `https://example.com/`) is equivalent.

The problem comes from servers and applications that accept several forms:

- **IIS** and some file systems ignore case: `/Contact` and `/contact` both return a 200.
- **Laravel** routes `/blog` and `/blog/` to the same action; behind Nginx, without a rule, both return a 200.
- **Vercel** serves both forms if `trailingSlash` is not set, and itself flags this as not recommended.
- **Inbound links** use whatever form their author typed: every variant ends up being crawled.

Google often consolidates these duplicates on its own, but not always towards the form you want, and every variant uses up a crawl. A single rule, enforced by redirects, solves the problem once and for all.

## What it improves

- **Indexing**: a single URL per page in the index, the one you chose.
- **Signal consolidation**: links pointing to a variant benefit the chosen form thanks to the redirect.
- **Crawling**: fewer useless URLs to crawl. The effect is noticeable mainly on large sites.
- **Statistics**: one row per page in analytics reports.
- **Rankings**: no direct effect; the benefit comes from consolidating duplicates.

## How to check

Test the four variants of an important page:

```bash
for u in "https://example.com/blog/mon-article/" "https://example.com/blog/mon-article" "https://example.com/Blog/Mon-Article/" "https://example.com/BLOG/MON-ARTICLE"; do
  printf '%s -> ' "$u"
  curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' "$u"
done
```

Passing result, for a site that chose the trailing slash:

```txt
https://example.com/blog/mon-article/ -> 200
https://example.com/blog/mon-article -> 301 https://example.com/blog/mon-article/
https://example.com/Blog/Mon-Article/ -> 301 https://example.com/blog/mon-article/
https://example.com/BLOG/MON-ARTICLE -> 301 https://example.com/blog/mon-article/
```

A 404 on uppercase variants is acceptable if nobody links to them; several 200s or a chain of two redirects are not. Repeat the test on a category, a product page and a URL with parameters.

Other ways:

- **Screaming Frog**: `URL` tab, “Uppercase” filter; `Response Codes` tab, internal redirection filter, to spot internal links that point to the wrong variant.
- **Search Console**: in the [Page indexing report](https://search.google.com/search-console/index), the reasons “Duplicate without user-selected canonical” and “Alternate page with proper canonical tag” often reveal case or trailing slash variants.

## How to implement

### Before you start

Choose the target form, then apply it everywhere: redirects, internal links, sitemap, canonical.

| Question | Recommendation |
|---|---|
| Case | Everything lowercase |
| Trailing slash | Keep the form that already dominates the index. Google prefers neither |
| Files (`.css`, `.jpg`, `.pdf`, `.xml`) | Never a trailing slash |
| Domain root | No rule needed |
| URL parameters | Kept as they are by the redirect |

Default forms of the main platforms: WordPress adds the trailing slash with most permalink structures; Shopify, Next.js and Laravel (on Apache) do not.

Three precautions:

- **A single hop.** Combine these rules with the protocol and `www` rules so that a URL like `http://Example.com/Blog` reaches its destination in one redirect. See [standardize HTTP/HTTPS and www/non-www](https://checklist-seo-geo.com/en/indexing-canonicalization/standardize-http-https-www-non-www).
- **Exceptions to lowercasing**: files whose names contain capital letters, short links or case-sensitive tokens, APIs. Exclude them explicitly.
- **Permanent redirects**: 301 or 308. See [use 301/308 for permanent moves](https://checklist-seo-geo.com/en/http-redirects/use-301-308-permanent-moves).

> **Warning:** never enable two opposite trailing slash rules (one in the CMS that adds it, one in the server that removes it): a redirect loop is guaranteed. After each change, run the curl test again.

### Apache

Versions: Apache 2.4 (`mod_rewrite` module).

**Trailing slash**, in the `.htaccess` file or the virtual host, before the CMS rules. To remove it (rule shipped by default in Laravel's `.htaccess`):

```apache
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]
```

To add it, except to files:

```apache
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.[a-zA-Z0-9]{1,5}$
RewriteRule ^ %{REQUEST_URI}/ [R=301,L]
```

**Lowercase**: the `tolower` function goes through a `RewriteMap`, which can only be declared in the server or virtual host configuration, not in a `.htaccess` file.

```apache
<VirtualHost *:443>
    ServerName example.com

    RewriteEngine On
    RewriteMap minuscules int:tolower

    RewriteCond %{REQUEST_URI} [A-Z]
    RewriteCond %{REQUEST_URI} !^/(api|media)/
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteRule ^(.*)$ ${minuscules:$1} [R=301,L]
</VirtualHost>
```

Adjust the exclusions (`api`, `media`). Test, then reload: `sudo apachectl configtest && sudo systemctl reload apache2`.

### Nginx

Versions: Nginx 1.24 and later; dynamic Perl module for lowercasing.

**Trailing slash**, in the `server` block. To remove it:

```nginx
location ~ ^(?<sans_slash>.+)/$ {
    return 301 $sans_slash$is_args$args;
}
```

To add it to paths without an extension:

```nginx
location ~ ^(?<chemin>[^.]*[^/])$ {
    return 301 $chemin/$is_args$args;
}
```

These regex blocks take precedence over prefix `location` blocks: place them carefully if the application has paths that must escape the rule (`/api`, `/wp-json`).

**Lowercase**: Nginx has no native function. The Perl module (`libnginx-mod-http-perl` on Debian and Ubuntu) provides one:

```nginx
# http context
perl_set $uri_minuscules 'sub { my $r = shift; return lc($r->uri); }';

# server block
location ~ [A-Z] {
    return 301 $scheme://$host$uri_minuscules$is_args$args;
}
```

Without the Perl module, do the redirect in the application (see Laravel, WordPress or Next.js) or on the CDN. Reload with `sudo nginx -t && sudo systemctl reload nginx`.

### IIS

Versions: IIS 10 with the URL Rewrite 2.1 module.

IIS ignores case: by default, `/Contact` and `/contact` both return a 200. With the URL Rewrite module, IIS Manager offers the “Enforce lowercase URLs” and “Append or remove the trailing slash symbol” templates (`URL Rewrite > Add Rule(s)`). The equivalent to paste into `web.config`:

```xml
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Minuscules" stopProcessing="true">
          <match url=".*[A-Z].*" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          </conditions>
          <action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent" />
        </rule>
        <rule name="Slash final" stopProcessing="true">
          <match url="(.*[^/])$" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{URL}" pattern="\.[a-zA-Z0-9]{1,5}$" negate="true" />
          </conditions>
          <action type="Redirect" url="{R:1}/" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
```

Remove the second rule if you chose URLs without a trailing slash.

### Cloudflare

Versions: Cloudflare dashboard, redirect rules (Single Redirects) and Workers, all plans, November 2026.

Open `Rules > Overview` ([direct link](https://dash.cloudflare.com/?to=/:account/:zone/rules/overview)), then `Create rule > Redirect Rule`: “Custom filter expression” option, target URL of type Dynamic, status code 301, “Preserve query string” ticked, then `Deploy`.

**Add the trailing slash** (all plans):

```txt
Filter expression:
(http.host eq "example.com" and not ends_with(http.request.uri.path, "/") and not http.request.uri.path contains ".")

Target URL expression:
concat("https://", http.host, http.request.uri.path, "/")
```

**Remove the trailing slash**:

```txt
Filter expression:
(http.host eq "example.com" and ends_with(http.request.uri.path, "/") and http.request.uri.path ne "/")

Target URL expression:
concat("https://", http.host, substring(http.request.uri.path, 0, -1))
```

**Lowercase**: the `matches` operator (regular expressions) is limited to the Business and Enterprise plans. On those plans:

```txt
Filter expression:
(http.host eq "example.com" and http.request.uri.path matches "[A-Z]")

Target URL expression:
concat("https://", http.host, lower(http.request.uri.path))
```

On the Free and Pro plans, do the lowercasing at the origin, or with a Worker bound to the `example.com/*` route:

```js
export default {
  async fetch(request) {
    const url = new URL(request.url);
    const cheminSansEncodage = url.pathname.replace(/%[0-9A-Fa-f]{2}/g, '');

    if (/[A-Z]/.test(cheminSansEncodage)) {
      url.pathname = url.pathname.toLowerCase();
      return Response.redirect(url.toString(), 301);
    }

    return fetch(request);
  },
};
```

Test each rule with curl before moving on to the next one.

### Plesk

Versions: Plesk Obsidian 18.0.

Paste the Apache trailing slash blocks into the site's `.htaccess` file. If Nginx serves the site on its own, paste the `location` blocks from the Nginx section into `Domains > your domain > Hosting & DNS > Apache & nginx Settings` (`Websites & Domains > your domain` in the legacy view), “Additional nginx directives” field, which is reserved for Plesk administrators. Lowercasing cannot be done from these fields without the Perl module: handle it in the application or on Cloudflare.

### cPanel

Versions: cPanel & WHM 126 to 136 (Jupiter interface).

Paste the Apache trailing slash blocks into `public_html/.htaccess` using File Manager. A `RewriteMap` is not allowed in a `.htaccess` file: for lowercasing, use the application or Cloudflare.

### Shared hosting

As with cPanel: trailing slash in the `.htaccess` file (LiteSpeed reads these rules too), case in the application or on a CDN.

### WordPress

Versions: WordPress 6.4 to 7.1.

**Trailing slash**: it follows the structure chosen in `Settings > Permalinks`. A structure ending with `/` (`/%postname%/`) makes WordPress itself redirect `/mon-article` to `/mon-article/`; a structure without a trailing slash does the opposite. Do not add a conflicting server rule.

**Lowercase**: WordPress produces lowercase slugs, but depending on the configuration it may return a 200 for an uppercase variant. If the test shows this, add this file, `wp-content/mu-plugins/url-minuscules.php`:

```php
<?php

add_action('template_redirect', function (): void {
    $requestUri = $_SERVER['REQUEST_URI'] ?? '/';
    $path = (string) parse_url($requestUri, PHP_URL_PATH);
    $query = parse_url($requestUri, PHP_URL_QUERY);

    if (! preg_match('/[A-Z]/', preg_replace('/%[0-9A-Fa-f]{2}/', '', $path))) {
        return;
    }

    $target = strtolower($path) . ($query ? "?{$query}" : '');

    wp_safe_redirect($target, 301);
    exit;
}, 0);
```

### Shopify

Versions: Shopify online store and Online Store 2.0 themes, all plans, November 2026.

Shopify sets the URL form itself (no trailing slash, lowercase handles) and does not let you configure redirects for variants. Check that the theme's canonical tag (`<link rel="canonical" href="{{ canonical_url }}">` in `layout/theme.liquid`) is present, and that your internal links, menus and campaigns use the exact form.

### Laravel

Versions: Laravel 10 to 13. The middleware is the same everywhere; only its registration changes from Laravel 11 onwards.

On Apache, the bundled `public/.htaccess` already removes the trailing slash. On Nginx (Forge, Cloud, container), `/blog` and `/blog/` both return a 200: add the Nginx removal block, or this middleware, which also handles case:

```php
<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class RedirectToCanonicalPath
{
    public function handle(Request $request, Closure $next): Response
    {
        if (! $request->isMethod('GET') && ! $request->isMethod('HEAD')) {
            return $next($request);
        }

        $path = $request->getPathInfo();
        $hasUppercase = preg_match('/[A-Z]/', preg_replace('/%[0-9A-Fa-f]{2}/', '', $path)) === 1;
        $hasTrailingSlash = $path !== '/' && str_ends_with($path, '/');

        if (! $hasUppercase && ! $hasTrailingSlash) {
            return $next($request);
        }

        $canonicalPath = rtrim(strtolower($path), '/') ?: '/';
        $query = $request->getQueryString();

        return redirect()->to($canonicalPath . ($query ? "?{$query}" : ''), 301);
    }
}
```

#### Laravel 11 to 13

Register it in `bootstrap/app.php`, at the top of the `web` group (import `App\Http\Middleware\RedirectToCanonicalPath`):

```php
->withMiddleware(function (Middleware $middleware): void {
    $middleware->web(prepend: [RedirectToCanonicalPath::class]);
})
```

#### Laravel 10

Middleware is declared in `app/Http/Kernel.php`: add the class at the top of the `web` group.

```php
protected $middlewareGroups = [
    'web' => [
        \App\Http\Middleware\RedirectToCanonicalPath::class,
        \App\Http\Middleware\EncryptCookies::class,
        // … other middleware in the group, unchanged
    ],
];
```

### Next.js

Versions: Next.js 15 and 16 (App Router and Pages Router).

By default, Next.js redirects `/about/` to `/about` (308). For the opposite, in `next.config.js`:

```js
module.exports = {
  trailingSlash: true,
};
```

Files with an extension and paths under `.well-known/` do not get a trailing slash. For lowercasing, a redirect runs before rendering; only the file name changes between versions.

#### Next.js 16

Add a `proxy.ts` file at the project root (or in `src/`):

```ts
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

export function proxy(request: NextRequest) {
  const { pathname } = request.nextUrl;

  if (!/[A-Z]/.test(pathname.replace(/%[0-9A-Fa-f]{2}/g, ''))) {
    return NextResponse.next();
  }

  const url = request.nextUrl.clone();
  url.pathname = pathname.toLowerCase();

  return NextResponse.redirect(url, 301);
}

export const config = {
  matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
};
```

#### Next.js 15

The file is called `middleware.ts` and the function `middleware`; `middleware.ts` is still accepted in Next.js 16 but is deprecated (`npx @next/codemod@canary middleware-to-proxy .` renames it).

```ts
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

export function middleware(request: NextRequest) {
  const { pathname } = request.nextUrl;

  if (!/[A-Z]/.test(pathname.replace(/%[0-9A-Fa-f]{2}/g, ''))) {
    return NextResponse.next();
  }

  const url = request.nextUrl.clone();
  url.pathname = pathname.toLowerCase();

  return NextResponse.redirect(url, 301);
}

export const config = {
  matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
};
```

### Vercel

Versions: Vercel, all plans, `vercel.json` configuration, November 2026.

Outside Next.js, declare the rule in `vercel.json`. Without this key, Vercel serves both forms without redirecting:

```json
{
  "trailingSlash": false
}
```

`true` adds the trailing slash (except to files with an extension), `false` removes it, with a 308 redirect in both cases.

### Netlify

Versions: Netlify, all plans, November 2026.

Netlify normalizes the trailing slash before applying `_redirects` rules: a rule cannot tell `/page` from `/page/`. The behavior depends on the structure of the published files (`page.html` or `page/index.html`). Test both forms and, if both return a 200, make sure the canonical points to the right one; finer handling requires an Edge Function.

## Common mistakes

- **Opposite rules at two levels**: the CMS adds the trailing slash, the server or CDN removes it. Redirect loop.
- **Lowercasing files**: `/images/Logo.PNG` redirected to `/images/logo.png` returns a 404 on a Linux server.
- **Redirect chain**: trailing slash, then lowercase, then HTTPS, in three hops. Group or order the rules for a single hop.
- **Redirecting without fixing internal links and the sitemap**: every internal link goes through a redirect and the sitemap contradicts the rule.
- **A canonical that contradicts the redirect**: the `/blog/` page declares `/blog` as its canonical.
- **Adding a trailing slash to URLs with an extension**: `/sitemap.xml/` or `/flux.rss/` stop working.

## Frequently asked questions

### Do URLs need a trailing slash for SEO?

No, Google prefers neither form. It does, however, treat /page and /page/ as two distinct URLs, except for the domain root. What matters is consistency: choose one form, usually the one your CMS already produces, 301-redirect the other, and use the chosen form in internal links, the sitemap and the canonical tag.

### Are URLs case-sensitive for Google?

Yes. Google treats /APPLE and /apple as two different URLs. If your server displays the same page for both, as IIS does by default, you create duplicates. Write all your URLs in lowercase and 301-redirect variants containing capital letters, excluding files and identifiers whose case is meaningful.

### What happens if both versions of a URL return a 200?

Google chooses a canonical version among the variants itself, based on links, the sitemap and the canonical tag. It often gets it right, but not always in favor of the form you want, and every variant uses up a crawl. In analytics tools, the same page appears on several rows. A 301 redirect to the single form removes this ambiguity.

### Can you redirect uppercase to lowercase in an .htaccess file?

Not directly. Apache's tolower function goes through a RewriteMap directive, which is only allowed in the server or virtual host configuration. On shared hosting or cPanel, do the redirect in the application, for example with a middleware or a small plugin, or on a CDN such as Cloudflare. The trailing slash, on the other hand, is easy to handle in the .htaccess file.

## Resources

- [Google Search Central: URL structure best practices](https://developers.google.com/search/docs/crawling-indexing/url-structure?hl=en)
- [Google Search Central: To slash or not to slash](https://developers.google.com/search/blog/2010/04/to-slash-or-not-to-slash)
- [Apache: RewriteMap](https://httpd.apache.org/docs/2.4/rewrite/rewritemap.html)
- [Nginx: Perl module](https://nginx.org/en/docs/http/ngx_http_perl_module.html)
- [Microsoft: URL Rewrite module SEO rule templates](https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/using-the-url-rewrite-module)
- [Cloudflare: Rules language functions](https://developers.cloudflare.com/ruleset-engine/rules-language/functions/) and [Single Redirects](https://developers.cloudflare.com/rules/url-forwarding/single-redirects/)
- [Next.js: trailingSlash](https://nextjs.org/docs/app/api-reference/config/next-config-js/trailingSlash) and [proxy](https://nextjs.org/docs/app/api-reference/file-conventions/proxy)
- [Vercel: trailingSlash in vercel.json](https://vercel.com/docs/project-configuration/vercel-json#trailingslash)

Next steps: [Control URL parameters](https://checklist-seo-geo.com/en/architecture-navigation/control-url-parameters) and [Align canonicals, sitemap and internal links](https://checklist-seo-geo.com/en/indexing-canonicalization/align-canonicals-sitemap-internal-links).
