Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple Apache2 Virtual Host for WordPress
<VirtualHost *:80>
ServerName wordpress.local
# Indexes + Directory Root.
DirectoryIndex index.php index.html
DocumentRoot /var/www/workspace/wordpress/
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteCond $1 ^(index\.php)?$ [OR]
RewriteCond $1 \.(gif|jpg|png|ico|css|js)$ [NC,OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ - [S=1]
RewriteRule . /index.php [L]
# END wordpress
Options FollowSymLinks
Order allow,deny
Allow from all
Copy link

endersaka commented May 17, 2022

Order and Allow are valid only in directory and .htaccess context.

This configuration if checked (httpd.exe -t or apachectl configtest) you will see this error:

AH00526: Syntax error on line XX of <path_to>/httpd-vhosts.conf:
order not allowed in <VirtualHost> context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment