.htaccess फ़ाइलों के लिए 301 रीडायरेक्ट कोड जेनरेट करें। अपने डोमेन के www से non-www या non-www से www वर्शन पर तुरंत रीडायरेक्ट करें।
Indexpro htaccess rewrite जेनरेटर टूल का उपयोग करके Htaccess के लिए www से non-www या non-www से www 301 रीडायरेक्ट कोड बनाएं। बस नीचे दिए 3 चरणों का पालन करें और "Get .htaccess Code" बटन पर क्लिक करें।
www शामिल न करें। केवल डोमेन नाम - जैसे yourdomain.com
.htaccess रीडायरेक्ट एक सर्वर कॉन्फ़िगरेशन निर्देश है जो विज़िटर को स्वचालित रूप से एक URL से दूसरे URL पर भेजता है। .htaccess फ़ाइल Apache वेब सर्वर पर उपयोग की जाने वाली एक शक्तिशाली कॉन्फ़िगरेशन फ़ाइल है।
301 रीडायरेक्ट एक स्थायी रीडायरेक्ट है जो सर्च इंजन को बताता है कि पेज स्थायी रूप से नए स्थान पर चला गया है। यह सबसे SEO-अनुकूल रीडायरेक्ट प्रकार है क्योंकि यह लगभग 90-99% लिंक इक्विटी पास करता है।
www से non-www (या इसके विपरीत) रीडायरेक्ट SEO के लिए विशेष रूप से महत्वपूर्ण है क्योंकि सर्च इंजन www.example.com और example.com को दो अलग-अलग वेबसाइट मानते हैं।
उचित .htaccess रीडायरेक्ट लागू करने से आपकी वेबसाइट के लिए कई फायदे मिलते हैं:
Four rules cover the great majority of real redirect work. Each goes in the .htaccess file at your document root, inside an IfModule mod_rewrite.c block with RewriteEngine On above it.
Sends every http request to the https version of the same URL, preserving the path.
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]Picks one canonical host so the same page is not reachable at two addresses.
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]For a page that moved. Point it at the closest equivalent, not the homepage.
Redirect 301 /old-page https://www.example.com/new-pageMoves a folder and everything under it, keeping the rest of the path intact.
RewriteRule ^old-folder/(.*)$ /new-folder/$1 [L,R=301]A 301 is permanent and tells Google to move the ranking signals to the new URL. A 302 is temporary and tells Google to keep the old one. Use 301 for anything that has genuinely moved. Using 302 by mistake is one of the most common ways sites lose rankings during a migration.
A 301 passes the great majority of it. What costs you is chaining: every extra hop adds latency and risk, and long chains can be abandoned by crawlers. Point the old URL at the final destination directly.
In the document root of your site, usually alongside the homepage file. Rules in a subdirectory's .htaccess apply only to that directory and below.
No. It is an Apache feature. Nginx uses its own configuration syntax and ignores .htaccess entirely, so rules pasted there will silently do nothing.
Almost always a rule that matches its own destination, so the redirect fires again on arrival. Adding a condition that excludes the target URL, such as a RewriteCond checking the host or path, breaks the cycle.
Only if there is genuinely no closer match. Google treats mass redirects to the homepage as soft 404s, which means the old URL gets dropped anyway. A relevant page or a clean 410 is usually better.