Remove unnecessary slashes from path

后端 未结 6 585
温柔的废话
温柔的废话 2021-02-06 08:00
$path = \'/home/to//my///site\';

I am trying to remove unnecessary forward slashes / from the path above

I am trying to get this

6条回答
  •  轮回少年
    2021-02-06 08:34

    Hello may this will helpful

    Write this code in your .Htaccess file and check it..

    # Prevent double slashes in URLs, e.g. //Blog and /Home//About
    RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
    RewriteRule . %1/%2 [R=301,L]
    

    Hope it will help you!

提交回复
热议问题