Garip URL Yapışıklığı
Facebook OAuth ile XenForo'ya giriş yapan kullanıcılar bazen URL'lerinin sonunda #_=_ gibi tuhaf bir ek görür: https://aior.com/community/#_=_. Bu işlevsel bir sorun değildir — sayfa normal çalışır — ama görsel olarak çirkin durur ve adres çubuğunu sürekli olarak işaretli görmek bazı kullanıcılarda güven kaybına yol açar.Sorunun Nedeni
Bu davranış Facebook'un OAuth redirect mekanizmasında bilinen bir tasarımdır. Facebook 2011'den beri redirect URL'lerine #_=_ hash'ini ekler. Sebebi: tarayıcı URL fragment'larının (# sonrası) sunucuya gönderilmemesi prensibinden faydalanarak XSS ve CSRF açıklarını minimize etmektir. Yani bilinçli bir güvenlik önlemidir.Ancak modern browser'larda XenForo veya başka uygulama redirect sonrası bu fragment'ı temizlemezse adres çubuğunda kalır.
XenForo Tarafında Otomatik Temizleme
Güncel XenForo sürümleri (2.2+) Facebook redirect sonrası bu fragment'ı otomatik olarak temizler. Eğer hâlâ görüyorsanız:1. XenForo sürümünüzü kontrol edin (Admin → Home altta versiyon)
2. En son patch sürümüne güncelleyin
3. Browser cache'ini temizleyin
4. Test edin
Manuel JavaScript Fix
Eski XenForo sürümlerinde veya custom theme'lerde, head veya footer template'ine aşağıdaki JS'i ekleyerek temizlik yapabilirsiniz:
Code:
<script>
if (window.location.hash === '#_=_') {
if (history.replaceState) {
var clean = window.location.href.split('#')[0];
history.replaceState(null, null, clean);
} else {
window.location.hash = '';
}
}
</script>
Bu kod sayfa yüklendiğinde URL fragment'ını kontrol eder; #_=_ ise history.replaceState API'si ile adres çubuğunu sessizce yeni URL'e günceller — sayfa yeniden yüklenmez.
XenForo Template'inde Hangi Dosya?
Yukarıdaki script'i Admin → Appearance → Templates altında page_container template'inin </head> etiketinden hemen önce ekleyin. Bu tüm forum sayfalarında yüklenir.Daha temiz yaklaşım: extra.less yanında js/ dizinine bir aior-fb-cleanup.js dosyası ekleyip script tag ile yüklemek.
Diğer OAuth Provider'lar
Bu sorun yalnızca Facebook'a özgüdür. Google, Apple, Microsoft, Twitter OAuth'ları bu hash'i eklemez. Yani sadece Facebook akışından sonra çalışan bir temizlik script'i yeterlidir.SEO ve Analytics Etkisi
URL fragment'ları sunucuya gönderilmez, dolayısıyla SEO'ya direkt etkisi yoktur. Ancak Google Analytics gibi sistemler client-side URL takip ederse fragment'lar farklı sayfa olarak sayılabilir; bu istatistikleri kirletir. Yukarıdaki temizleme script'i Analytics yüklenmeden ÖNCE çalıştırılırsa istatistik temiz kalır.Üretim Tavsiyeleri
Modern XenForo + güncel sürüm = sorun yok. Custom theme veya eski sürüm kullanıyorsanız manuel JS fix uygulayın. Browser cache'i agressively kullanan setup'larda Service Worker bile devreye girebilir; bu durumda Service Worker'ı bypass eden bir cleanup gerekir.AIOR olarak XenForo barındırma müşterilerimize bu tür küçük UX tweak'lerini standart kurulum paketimizde uyguluyoruz; ek bir geliştirme talebine gerek kalmaz.
A Strange URL Suffix
Users signing into XenForo via Facebook OAuth sometimes see a weird suffix in the URL: #_=_ — for example https://aior.com/community/#_=_. It's not a functional problem — the page works normally — but it looks ugly in the address bar and can shake user trust.Why It Happens
This is a well-known design choice in Facebook's OAuth redirect. Since 2011 Facebook appends a #_=_ hash to redirect URLs. The reason: browser URL fragments (after #) are never sent to the server — Facebook leverages this to minimise XSS and CSRF risks. It's a deliberate security measure.But in modern browsers, if XenForo or your app doesn't clean the fragment after redirect, it stays in the address bar.
Automatic Cleanup in XenForo
Current XenForo versions (2.2+) automatically strip this fragment after a Facebook redirect. If you're still seeing it:1. Check your XenForo version (Admin → Home, version at bottom)
2. Upgrade to the latest patch
3. Clear browser cache
4. Retest
Manual JavaScript Fix
On older XenForo versions or custom themes, add this JS to your head or footer template:
Code:
<script>
if (window.location.hash === '#_=_') {
if (history.replaceState) {
var clean = window.location.href.split('#')[0];
history.replaceState(null, null, clean);
} else {
window.location.hash = '';
}
}
</script>
This code checks the URL fragment on page load; if it's #_=_, it silently rewrites the address bar via history.replaceState — no page reload.
Where to Add It in XenForo Templates
Add the script just before </head> in the page_container template under Admin → Appearance → Templates. This loads on every forum page.Cleaner approach: drop a js/aior-fb-cleanup.js alongside extra.less and reference it from a script tag.
Other OAuth Providers
This issue is Facebook-specific. Google, Apple, Microsoft and Twitter OAuth don't add this hash, so a cleanup script targeted at Facebook flow is sufficient.SEO and Analytics Impact
URL fragments aren't sent to the server, so direct SEO impact is none. However, Google Analytics and similar client-side trackers can record fragments as separate URLs — polluting your reports. Running the cleanup script BEFORE Analytics loads keeps stats clean.Production Tips
Modern XenForo + current version = problem solved. For custom themes or older versions, apply the JS fix. In setups using aggressive browser caching or a Service Worker, you may need a service-worker-aware cleanup.At AIOR we ship these small UX tweaks as part of the standard XenForo hosting setup — no extra dev request needed.