Questions about htaccess, level two domain name, online, etc.

Source: Internet
Author: User
Good morning everyone, the problem is
Website, there are two level domain name, now can be normal access, but not with the WWW but access to level two went,
The following is the. htaccess code
Rewriteengine on
Rewritebase/
Rewritecond%{http_host} ^www.518visa.net$
Rewritecond%{request_uri}!^/
Rewritecond%{request_filename}!-f
Rewritecond%{request_filename}!-d
Rewriterule ^ (. *) $/$1
Rewritecond%{http_host} ^www.518visa.net$
Rewriterule ^ (/)? $/[L]
#以下为二级, if there is a simpler hope to teach, thank you
Rewritecond%{http_host} ^ ([a-za-z]*[^www\b]). 518visa.net$
Rewritecond%{request_uri}!^visalist/
Rewritecond%{request_filename}!-f
Rewritecond%{request_filename}!-d
Rewritecond%{http_host} ^ ([a-za-z]*[^www\b]). 518visa.net$
Rewriterule ^ ([1-9]\d*). HTML ($) visalist/visa_detail.php?id=$1
Rewriterule ^ (/)? $ visalist/[L]

URL for www.518visa.net, non-external chain ads, trouble to see, thank you.
Red box selected, click to go to the level two domain name


What I need now is to go directly to band www without www access, such as abc.com/a.html go to www.abc.com/a.html, I used the
Rewritecond%{http_host}!^www.518visa.net$ [NC]
Rewriterule ^ (. *) $ http://www.518visa.net/$1 [l,r=301]
Not even this one.
Thank you, online and so on.


Reply to discussion (solution)

I use the following:

#301RewriteCond%{http_host} ^xxx.net [Nc]rewriterule ^ (. *) $ http://www.xxx.net/$1 [l,r=301] #aaaa. Xxx.net-is Okrewritecond%{http_host} (?! WWW|WW) ^[a-z0-9\-]+.xxx.net$rewriterule ^/?$/%{http_host}rewriterule ^/([a-z0-9\-]+). xxx.net$      /1.php?keyword =$1


If not, look at what your Apache DocumentRoot set up.
If not, you can consider using the alternative.
Build a xxx.net web and then make a htaccess in this web 301 to www
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.