Good morning to everyone about htaccess and second-level domain names. The problem is that the website has a second-level domain name, which can be accessed normally now, but the second-level domain name is accessed without www, the following are. htaccess code RewriteEngine & nbsp; onRewriteBase & nbsp; RewriteCond & nbsp; % {HTTP_HOST} & nbsp; ^ www.518visa.net $ Rew questions about htaccess, second-level domain names, online, etc.
Good Morning, everyone. The problem is
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.
------ Solution --------------------
I use the following:
#301
RewriteCond % {HTTP_HOST} ^ xxx.net [nc]
RewriteRule ^ (. *) $ http://www.xxx.net/1121 [L, R = 301]
# Aaaa.xxx.net-is OK
RewriteCond % {HTTP_HOST }(?! Www
------ Solution --------------------
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