Answers for "how to remove double slash from the url with .htaccess"

0

how to remove double slash from the url with .htaccess

<IfModule mod_rewrite.c>
    RewriteBase /

    # rule 1: remove multiple leading slashes (directly after the TLD)
    RewriteCond %{THE_REQUEST} \s/{2,}
    RewriteRule (.*) $1 [R=301,L]

    # rule 2: remove multiple slashes in the requested path
    RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$
    RewriteRule (.*) %1/%2 [R=301,L]
</IfModule>
Posted by: Guest on September-16-2021

Code answers related to "how to remove double slash from the url with .htaccess"

Browse Popular Code Answers by Language