简体   繁体   中英

How to configure .htaccess for a subdomain?

I want to show pages on a subdomain test.mysite.com , I have several folders on this subdomain, so if someone goes to test.mysite.com/siteone it will show you the site on that folder.

How do I configure the .htaccess file? I have the following code, which I found in some questions but it doesn't work:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]
</IfModule>

".htaccess files provide a way to make configuration changes on a per-directory basis." http://httpd.apache.org/docs/2.2/howto/htaccess.html

When a user fires a request in the browser, it walks all the way down: 1 server computer 2 apache service 3 (v)host configuration (via http.conf, which is preloaded into apache service) 4 directory configuration (which is loaded on demand)

so, nope, you cannot configure vhosts in .htaccess, because it is out of reach

if you have access to the http.conf or subsequent include files, just look at http://httpd.apache.org/docs/current/vhosts/examples.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM