Bu çok minik ama gayet faydalı bir bilgi.
Web sitelerinde bazen adresler yanlışlıkla örneğin; https://wolkanca.com/falan// gibi veya https://wolkanca.com//filan/ yazılabilir, bazen de başka bir nedenden bu tür adreslere talep görülebilir.
Bu durumda hatalı olan çift bölme işaretini teke düşürüp doğru olanı talep eden tarafa vermek için bir .htaccess kuralı kullanabiliriz, çok basit.
Sitenin .htaccess dosyasına aşağıdaki gibi yazıldığında çift bölme işareti(slash) sorununu halletmiş oluruz:
RedirectMatch 301 ^(.*)//+(.*)$ https://wolkanca.com/$1/$2
wolkanca.com kısmını site adresi ile değiştirin.
“.htaccess ipucu: çift slash kaldırma, düzeltme” için 2 yanıt
bu yöntem wordpress super cache de sorun yaşatabilir, sorun yaşamamak için super cache ayarını half cache yapmak gerekir.
veya
1. /.htaccess dosyasına aşağıdaki gibi yazın:====================================rewriteengine onrewritecond %{request_uri} //+rewriterule ^(.*)$ /slashfix.php [l]2. slashfix.php, aşağıdaki gibi olacak, ana dizine atın:==========================================================<?php$prot = $_server["server_protocol"];$host = "http://" . $_server["http_host"];$req = $_server["request_uri"];$script = $_server["script_name"];$sig = $_server["server_signature"];$newloc = $host . preg_replace('|//+|', '/', $req);if ($req == $script) die("unable to redirect.
"😉;header("$prot 301 moved permanently"😉;header("location: $newloc"😉;?><html><head><title>invalid request uri</title></head><body><h1>invalid request uri</h1>the uri you provided contains consecutive forward slashes,which are not accepted by this website. please try visiting<a href="<?php echo $newloc; ?>"><?php echo $newloc; ?> instead.<hr><?php echo $sig; ?></body></html>
enteresan güzel bir bilgi saol.