Teknik SEO Audit Nedir?
Teknik SEO audit, web sitenizin arama motoru botları tarafından düzgün taranıp taranamadığını, indekslenip indekslenmediğini ve teknik sorunların belirlenmesini amaçlayan bir denetim sürecidir.
1. Robots.txt Doğru Yapılandırma
<?php
header('Content-Type: text/plain');
echo "User-agent: *
Allow: /
Disallow: /admin/
Disallow: /api/
Disallow: /tmp/
Disallow: /*?sort=
Disallow: /*?filter=
Sitemap: https://kodlaver.com/sitemap.xml";
2. Canonical URL Yönetimi
function get_canonical_url() {
$scheme = isset($_SERVER['HTTPS']) ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'];
$path = strtok($_SERVER['REQUEST_URI'], '?');
$path = rtrim($path, '/');
if ($path === '') $path = '/';
return $scheme . '://' . $host . $path;
}
?>
<link rel="canonical" href="<?= get_canonical_url() ?>" />
3. PHP ile Otomatik SEO Denetimi
function audit_page($url) {
$html = file_get_contents($url);
$issues = [];
if (!preg_match('/<title>(.{10,60})<\/title>/i', $html)) {
$issues[] = 'Title etiketi eksik veya uygun değil (10-60 karakter)';
}
if (!preg_match('/meta name="description" content="(.{50,160})"/i', $html)) {
$issues[] = 'Meta description eksik veya uygun değil (50-160 karakter)';
}
preg_match_all('/<h1[^>]*>(.*?)<\/h1>/i', $html, $h1s);
if (count($h1s[0]) !== 1) {
$issues[] = 'Sayfada ' . count($h1s[0]) . ' adet H1 var (1 olmalı)';
}
preg_match_all('/<img(?![^>]*alt=)[^>]*>/i', $html, $imgs);
if (count($imgs[0]) > 0) {
$issues[] = count($imgs[0]) . ' resimde alt etiketi eksik';
}
if (strpos($html, 'rel="canonical"') === false) {
$issues[] = 'Canonical URL etiketi eksik';
}
return $issues;
}