Do I need to use .htaccess
file for a multisite? I have setup basic wordpress site and configured it with apache2 VirtualHost as:
<VirtualHost *:80>
...
RewriteEngine On
Options FollowSymLinks
# THIS REDIRECTS TO HTTPS
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
DocumentRoot /var/www/example/
<Directory /var/www/example/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
...
DocumentRoot /var/www/example/
<Directory /var/www/example/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
SSLEngine on
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
However, when I follow the steps to enable multisite, wordpress prompts me to paste these options to my .htaccess
file:
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]
But I do not have an .htaccess
file. However If I make it, and configure apache, rewrite rules do not work, e.g. example.com/wp-admin
is not rewritten into wp-admin/
with a trailing slash, but into ugly long link: https://example.com/wp-login.php?redirect_to=https%3A%2F%2Fexample.com%2Fwp-admin%2F&reauth=1
. Can this be because of SSL rewrite rules? My questions are: do I need .htaccess
? And how do I make its rewrite rules work?