简体   繁体   中英

Changing .htaccess file in order to allow subdomains

I'm hosting a Wordpress page in my domain and I would like to create a subdomain in order to host also a wiki page.

Example:

www.foowordpress.com -> Points to a Wordpress blog
wiki.foowordpress.com -> It should point to a Media Wiki page

It seems that the .htaccess generated by Wordpress redirects all subdomains to the Wordpress index page.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Could someone suggest how to change this .htaccess file in order not to redirect the wiki subdomain?

I've already configured my DNS manager and my VirtualHost for creating this subdomain.

As it turns out, I had not configured properly the VirtualHost file, there was nothing wrong with the .htaccess file.

Here is my VirtualHost file for the subdomain in case anyone finds it useful:

<VirtualHost *:80>   
  # Admin email, Server Name (domain name), and any aliases  
  ServerAdmin webmaster@foo.com   
  ServerName  www.wiki.foo.com
  ServerAlias wiki.foo.com

  # Index file and Document Root (where the public files are located) 
  DirectoryIndex index.html index.php   
  DocumentRoot /var/www/wiki.foo.com/

  # Log file locations   LogLevel warn   ErrorLog 
  /var/log/apache2/wiki.foo.com/error.log   CustomLog
  /var/log/apache2/wiki.foo.com/access.log combined 
</VirtualHost>

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