title: How to add WordPress' htaccess configurations into VirtualHost conf
body: <p>I put WordPress' configuration into my VirtualHost directive, it looks like this:</p>
  <pre><code>&lt;VirtualHost *:80&gt;
  ServerName www.example.com
  ServerAlias example.com
  DocumentRoot /var/www/html
  
  &lt;Directory /&gt;
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  
  # add a trailing slash to /wp-admin
  RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
  
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]
  RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
  RewriteRule ^(.*\.php)$ $1 [L]
  RewriteRule . index.php [L]
  &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  <p>When I put WordPress' configuration inside VirtualHost's root directory like above, the permalink and sub domain won't work.</p>
  <p>But when I put WordPress' configuration inside the <code>/etc/httpd/conf/httpd.conf</code> root directory which is <code>/var/www/html</code> (as you can see it is the same root as Virtual host), then subdomain and permalinks are fine, I don't get it?</p>
  <p>The reason I don't want to put WordPress' configuration in <code>httpd.conf</code> is because I want to make another site but it's not multisite, so I have to enter another <a href="https://wordpress.org/support/article/htaccess/" rel="nofollow noreferrer">WordPress' configuration</a> on it.</p>
  <ul>
  <li>I IncludeOptional the virtual host conf file at the very bottom of <code>httpd.conf</code></li>
  <li>I use CentOS 7</li>
  <li>Apache 2.4</li>
  <li>Wordpress 4.5.3</li>
  <li>Mod rewrite included</li>
  </ul>