Regular Expressions 101

Community Patterns

Workaround for IIS rewrite rule redirects with urls

1

Regular Expression
PCRE2 (PHP >=7.3)

/
(http[s]?):(\/+)
/
gm

Description

Make sure http[s]:// uses two slashes, not one.

IIS rewrite rules removes double slashes in the raw URL, breaking YOURLS (PHP) for example. This regexp changes all single slashes to double after a web protocol, including nested querystrings.

Submitted by DeveloperDog - 7 months ago (Last modified 7 months ago)