Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Virtual host .htaccess pseudo-static (URL rewrite) to establish multi-site

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Apache hosts generally support .htaccess pseudo-static, that is, you can bind domain names to subdirectories and multiple sites in one space.

Application example: bind www.qijingling.com to htaccess directory

.htaccess content under the root directory

RewriteEngine OnRewriteBase / # bind www.qijingling.com to subdirectory htaccessRewriteCond% {HTTP_HOST} ^ www.qijingling.com$ [NC] RewriteCond% {REQUEST_URI}! ^ / moban/RewriteRule ^ (. *) $moban/$1 [Lmai QSA] # you can bind more than one, just repeat the previous three lines of code and change the domain name and directory name

.htaccess content under the htaccess directory

RewriteEngine OnRewriteBase / # can only be accessed by bound domain names Other domain names jump to RewriteCond% {HTTP_HOST}! ^ www.qijingling.com$ [NC] RewriteRule (. *) http://www.qijingling.com/$1 [L RewriteCond% {REQUEST_URI} ^ / moban\ / [NC] RewriteCond% {QUERY_STRING}! ^ (. *) # htaccess.800m.net/htaccess actually accesses www.qijingling.com/moban/htaccessRewriteRule ^ (. *) $/% {REQUEST_URI} /% {REQUEST_URI} / $1 [LMagne QSA]

Of course, if you don't need to bind a subdirectory, you don't need to create an .htaccess file in the subdirectory.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report