تمام عصام نشر 3 فبراير أرسل تقرير نشر 3 فبراير لدي مشكلة في عدم فهرسة النشرات الجوية في موقعي بعد التعديلات ليصبح شكل رابط النشرة متوافق ما محرك البحث مثل https://ajwa4alearab.freewebhostmost.com/Blog/article_Weather/كابوس-الفيضانات-يعود-في-تونس-أجواء-العرب-ترصد-المشاهد-الصادمة-للفيضانات-التاريخية-245 لكن جوجل لا يزحف لموقع للعلم اني اضفت خريطة موقع https://ajwa4alearab.freewebhostmost.com/Blog/sitemap.xml الحل لو تكرمتم استخدم RewriteEngine On RewriteRule ^article_Weather/(.*)-(\d+)$ article_Weather.php?id=$2 [L,QSA] RewriteCond %{THE_REQUEST} /article_Weather\.php\?id=([0-9]+) [NC] RewriteRule ^ /Blog/article_Weather/%1? [R=301,L] هذا كود الصفحة <?php require 'db.php'; // دالة إنشاء slug من النص function createSlug($text) { // إزالة جميع الأحرف غير الآمنة $text = preg_replace('/[^\p{Arabic}\p{L}\p{N}\s]/u', '', $text); // استبدال المسافات بشرطات $text = preg_replace('/\s+/', '-', $text); // إزالة الشرطات من البداية والنهاية $text = trim($text, '-'); // تحويل إلى حروف صغيرة return mb_strtolower($text); } // جلب معرف المقال من الرابط if (preg_match('/-(\d+)$/', $_SERVER['REQUEST_URI'], $matches)) { $id = $matches[1]; } else { header('Location: 404.php'); exit; } $stmt = $conn->prepare("SELECT a.title, a.content, a.category, a.created_at, a.image_url, u.username, u.profile_image, u.bio FROM articles a JOIN users u ON a.user_id = u.id WHERE a.id = ?"); $stmt->execute([$id]); $article = $stmt->fetch(); if (!$article) { header('Location: 404.php'); exit; } $title = base64_decode($article['title']); $category = base64_decode($article['category']); $content = base64_decode($article['content']); $image_url = $article['image_url']; $username = base64_decode($article['username']); $profile_image = $article['profile_image']; $bio = base64_decode($article['bio']); $slug = createSlug($title); // جلب المقالات ذات الصلة $related_articles = getRelatedArticles($conn, $article['category'], $id); // جلب المقالات المقترحة $suggested_articles = getSuggestedArticles($conn, $content, $id); // جلب المقالات الأحدث $latest_articles = getLatestArticles($conn, $id); function getRelatedArticles($conn, $category, $currentArticleId) { $stmt = $conn->prepare("SELECT id, title, image_url FROM articles WHERE category = ? AND id != ? ORDER BY created_at DESC LIMIT 3"); $stmt->execute([$category, $currentArticleId]); $articles = $stmt->fetchAll(); foreach ($articles as &$article) { $article['title_decoded'] = base64_decode($article['title']); $article['slug'] = createSlug($article['title_decoded']); } return $articles; } function getSuggestedArticles($conn, $content, $currentArticleId) { $keywords = extractKeywords($content); $stmt = $conn->prepare("SELECT id, title, content, image_url FROM articles WHERE id != ?"); $stmt->execute([$currentArticleId]); $all_articles = $stmt->fetchAll(); $suggested_articles = []; foreach ($all_articles as $article) { $article['title_decoded'] = base64_decode($article['title']); $article['slug'] = createSlug($article['title_decoded']); $articleKeywords = extractKeywords(base64_decode($article['content'])); $similarity = calculateCosineSimilarity($keywords, $articleKeywords); if ($similarity > 0.2) { $suggested_articles[] = $article; } } usort($suggested_articles, function($a, $b) use ($keywords) { $aKeywords = extractKeywords(base64_decode($a['content'])); $bKeywords = extractKeywords(base64_decode($b['content'])); return calculateCosineSimilarity($keywords, $bKeywords) <=> calculateCosineSimilarity($keywords, $aKeywords); }); return array_slice($suggested_articles, 0, 3); } function getLatestArticles($conn, $currentArticleId) { $stmt = $conn->prepare("SELECT id, title, image_url FROM articles WHERE id != ? ORDER BY created_at DESC LIMIT 3"); $stmt->execute([$currentArticleId]); $articles = $stmt->fetchAll(); foreach ($articles as &$article) { $article['title_decoded'] = base64_decode($article['title']); $article['slug'] = createSlug($article['title_decoded']); } return $articles; } function extractKeywords($text) { $text = preg_replace('/[^\p{L}\p{N}\s]/u', '', $text); $text = mb_strtolower($text); $words = preg_split('/\s+/', $text, -1, PREG_SPLIT_NO_EMPTY); $stopWords = ['و', 'في', 'من', 'على', 'إلى', 'عن', 'أن', 'هذا', 'هذه', 'ذلك', 'هؤلاء']; $words = array_diff($words, $stopWords); return array_count_values($words); } function calculateCosineSimilarity($vec1, $vec2) { $intersection = array_intersect_key($vec1, $vec2); $dotProduct = 0; $magnitude1 = 0; $magnitude2 = 0; foreach ($intersection as $key => $value) { $dotProduct += $vec1[$key] * $vec2[$key]; } foreach ($vec1 as $key => $value) { $magnitude1 += $value * $value; } foreach ($vec2 as $key => $value) { $magnitude2 += $value * $value; } $magnitude1 = sqrt($magnitude1); $magnitude2 = sqrt($magnitude2); return ($magnitude1 == 0 || $magnitude2 == 0) ? 0 : $dotProduct / ($magnitude1 * $magnitude2); } ?> <!DOCTYPE html> <html lang="ar"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Title & SEO Meta Tags --> <title><?= htmlspecialchars($title) ?></title> <meta name="description" content="<?= htmlspecialchars($title) ?> - <?= htmlspecialchars($category) ?> - <?= htmlspecialchars(substr(strip_tags($content), 0, 150)) ?>"> <meta name="keywords" content="<?= htmlspecialchars($category) ?>, <?= htmlspecialchars($title) ?>, مقالات, أخبار, مدونة"> <!-- Open Graph / Facebook --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"> </head> <body> <?php include 'article_navbar.php'; ?> <div class="container"> <div class="article-header"> <h1 class="article-title"><?= htmlspecialchars($category) ?> | <?= htmlspecialchars($title) ?></h1> <p class="article-date"><em><?= $article['created_at'] ?></em></p> </div> <?php if (!empty($image_url)): ?> <div class="article-images"> <img src="<?= htmlspecialchars($image_url) ?>" alt="<?= htmlspecialchars($title) ?>"> </div> <?php endif; ?> <div class="article-content"> <?= $content ?> </div> <?php include 'ad.php'; ?> <div class="article-categories"> التصنيفات: <?= htmlspecialchars($category) ?> </div> <div class="profile" onclick="toggleProfilePopup()"> <?php if (!empty($profile_image)): ?> <img src="<?= htmlspecialchars($profile_image) ?>" alt="<?= htmlspecialchars($username) ?>"> <?php endif; ?> <p class="username"><?= htmlspecialchars($username) ?></p> </div> <div id="profile-popup" class="profile-popup"> <h5><?= htmlspecialchars($username) ?></h5> <p><?= htmlspecialchars($bio) ?></p> </div> <!-- صور المقال مع وصف محسن --> <!-- المقالات ذات الصلة --> <?php if (count($related_articles) > 0): ?> <div class="related-articles"> <h2>مقالات مرتبطة</h2> <?php foreach ($related_articles as $related): ?> <a href="https://ajwa4alearab.freewebhostmost.com/Blog/article_Weather/<?= $related['slug'] ?>-<?= $related['id'] ?>" class="related-article" itemprop="relatedLink"> <img src="<?= htmlspecialchars($related['image_url']) ?>" alt="<?= htmlspecialchars($related['title_decoded']) ?>" title="<?= htmlspecialchars($related['title_decoded']) ?>"> <div class="related-article-title"><?= htmlspecialchars($related['title_decoded']) ?></div> </a> <?php endforeach; ?> </div> <?php endif; ?> <!-- المقالات المقترحة --> <?php if (count($suggested_articles) > 0): ?> <div class="suggested-articles"> <h2>اقتراحات مبنية على قراءتك</h2> <?php foreach ($suggested_articles as $suggested): ?> <a href="https://ajwa4alearab.freewebhostmost.com/Blog/article_Weather/<?= $suggested['slug'] ?>-<?= $suggested['id'] ?>" class="suggested-article" itemprop="suggestedLink"> <img src="<?= htmlspecialchars($suggested['image_url']) ?>" alt="<?= htmlspecialchars($suggested['title_decoded']) ?>" title="<?= htmlspecialchars($suggested['title_decoded']) ?>"> <div class="suggested-article-title"><?= htmlspecialchars($suggested['title_decoded']) ?></div> </a> <?php endforeach; ?> </div> <?php endif; ?> <!-- أحدث المقالات --> <?php if (count($latest_articles) > 0): ?> <div class="suggested-articles"> <h2>جديدنا</h2> <?php foreach ($latest_articles as $latest): ?> <a href="https://ajwa4alearab.freewebhostmost.com/Blog/article_Weather/<?= $latest['slug'] ?>-<?= $latest['id'] ?>" class="suggested-article" itemprop="latestLink"> <img src="<?= htmlspecialchars($latest['image_url']) ?>" alt="<?= htmlspecialchars($latest['title_decoded']) ?>" title="<?= htmlspecialchars($latest['title_decoded']) ?>"> <div class="latest-article-title"><?= htmlspecialchars($latest['title_decoded']) ?></div> </a> <?php endforeach; ?> </div> <?php endif; ?> </div> <?php include 'footer.php'; ?> <script> function toggleProfilePopup() { var popup = document.getElementById('profile-popup'); popup.style.display = popup.style.display === 'block' ? 'none' : 'block'; } </script> </body> </html> 1 اقتباس
0 Mustafa Suleiman نشر 4 فبراير أرسل تقرير نشر 4 فبراير أولاً عند إجراء أية تعديلات في موقعك، فلا تتوقع أن تظهر فورًا في جوجل، فالأمر بحاجة إلى وقت. ثانيًا توجه إلى google search console واختر موقعك ثم انتقل إلى Sitemaps في القائمة الجانبية، وأدخل مسار ملف sitemap وانقر على Submit. ثم استخدم أداة فحص URL وأدخل بها رابط جديد، هل هناك استجابة سليمة؟ بعد ذلك قم بطلب أرشفة بعض الروابط من خلال نفس الأداة، وفي حال الروابط الجديدة لا يتم أرشفتها خلال 3 أيام مثلاً، وظهرت لك أخطاء في صفحة الأرشفةgoogle search console، إذن يوجد مشكلة تقنية بالموقع. إن كانت الأخطاء غير واضحة، حاول تعديل قواعد إعادة الكتابة في .htaccess: RewriteEngine On RewriteRule ^Blog/article_Weather/(.*)-(\d+)$ /Blog/article_Weather.php?id=$2 [L,QSA,NC] RewriteCond %{THE_REQUEST} /Blog/article_Weather\.php\?id=([0-9]+) [NC] RewriteRule ^ /Blog/article_Weather/%1? [R=301,L,NE] Blog/ إلى المسار ليتوافق مع هيكل الموقع، واستخدام NE (No Escape) للحفاظ على الترميز الصحيح للأحرف الخاصة. السطر الأول هو لإعادة كتابة الرابط الجميل إلى الملف PHP، والثاني لإعادة التوجيه الدائم من الرابط القديم إلى الجديد ثم تفقد الروابط العربية والتأكد من أنها مُرمَّزة بشكل صحيح من خلال استخدام rawurlencode() عند إنشاء الـ slugs. function createSlug($text) { $text = preg_replace('/[^\p{Arabic}\p{L}\p{N}\s]/u', '', $text); $text = str_replace(' ', '-', $text); $text = trim($text, '-'); return rawurlencode(mb_strtolower($text)); } أيضًا التحقق من ملف robots.txt، لنتأكد من أنه لا يمنع الزحف إلى صفحات المقالات: User-agent: * Allow: / Disallow: /admin/ 1 اقتباس
السؤال
تمام عصام
لدي مشكلة في عدم فهرسة النشرات الجوية في موقعي بعد التعديلات ليصبح شكل رابط النشرة متوافق ما محرك البحث مثل
https://ajwa4alearab.freewebhostmost.com/Blog/article_Weather/كابوس-الفيضانات-يعود-في-تونس-أجواء-العرب-ترصد-المشاهد-الصادمة-للفيضانات-التاريخية-245
لكن جوجل لا يزحف لموقع للعلم اني اضفت خريطة موقع
https://ajwa4alearab.freewebhostmost.com/Blog/sitemap.xml
الحل لو تكرمتم
استخدم
هذا كود الصفحة
1 جواب على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.