For questions about htaccess and second-level domain names, good morning for everyone online. what's the problem?
The website has a second-level domain name. now it can be accessed normally, but it has been accessed to level-2 without www,
The. htaccess code is as follows:
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]
# The following is Level 2. if you have more simple suggestions, 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 * pai.html ($) visalist/visa_detail.php? Id = $1
RewriteRule ^ (/)? $ Visalist/[L]
The website is www.518visa.net. it is a non-External link advertisement. Please check it out. thank you.
Selected in the red box. click it to enter the second-level domain name.
What I need now is to directly transfer www without www access, such as abc.com/a.htmlto www.abc.com/a.html. I use
RewriteCond % {HTTP_HOST }! ^ Www.518visa.net $ [NC]
RewriteRule ^ (. *) $ http://www.518visa.net/#1 [L, R = 301]
This cannot be done either.
Thanks, online, etc.
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, check what documentroot has set in your apache.
If not, consider using a work und.
Create a xxx.net web, and then create an htaccess 301 to www