यदि आप केवल नाम के डोमेन भाग में कुछ लिखने की कोशिश कर रहे हैं, उदा। एक सामान्य गलत वर्तनी को ठीक करने के लिए, आपको 'विरासत' विकल्प की भी आवश्यकता नहीं है। मैं सभी अमान्य होस्ट नामों को पकड़ने के लिए एक नाम-वर्चुअल होस्ट सेट अप करता हूं और उन्हें पुनर्निर्देशित करने से पहले उन्हें सही तरीके से पुन: प्राप्त करता हूं।
चूंकि यह रीडायरेक्ट का उपयोग करता है, इसलिए उचित वर्चुअल होस्ट को पुनः लिखने के बाद पाया जाएगा।
Options +Indexes +FollowSymLinks
RewriteEngine on
# If it begins with only domain.com, prepend www and send to www.domain.com
RewriteCond %{HTTP_HOST} ^domain [NC]
RewriteRule ^(.*) http://www.domain.com$1 [L,R=301]
# Correct misspelling in the domain name, applies to any VirtualHost in the domain
# Requires a subdomain, i.e. (serviceXXX.)domain.com, or the prepended www. from above
RewriteCond %{HTTP_HOST} ^([^.]+\.)dommmmmain\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+\.)?domain.com(.*) http://$1domain.com$2 [L,R=301]
# No-name virtual host to catch all invalid hostnames and mod_rewrite and redirect them
<VirtualHost *>
RewriteEngine on
RewriteOptions inherit
</VirtualHost>
स्रोत
2010-07-09 14:39:25
पवित्र बकवास। मैंने सबको फेंक दिया है। – hourback
तो ऐसा लगता है कि आपके पास है। – UnkwnTech