English 中文(简体)
• 如何使“吉大港山区”——“红外线”
原标题:How to make %{HTTP_HOST} always return non-www

我有这一间接法,我希望它总是将%{吉大港山区-HOST}作为非www,而不管使用什么子。

RewriteEngine On
RewriteRule ^.*$ http://www.mywebsite.com/%{HTTP_HOST} [L,R=301]

http://www.mywebsite2.com/website2.com。

感谢你们的时间。

问题回答

I would use Google, and click the first link.
http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/

然后,你们只能改变礼仪,使之与任何东西相匹配,而不是具体地说不与www。

你可以尝试这样的事情:

# we are now working on HTTP_REFERER,
# change to appropriate variable according to your needs
#   check if we got at least 2 dots in the URL
RewriteCond %{HTTP_REFERER} .([^.]+).([A-Z]{2,3})$ [NC]
#   if the condition was met, redirect using only last 2 parts of URL
RewriteRule ^ http://www.mywebsite.com/%1.%2 [R,L]

让我知道这是否有益。

您 重温统治就是这样:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(?:[^.]+.)(.+)$ [NC]
RewriteRule ^ http://www.mywebsite.com/%1%{REQUEST_URI} [L,R]




相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...

热门标签