Simple Apache2 Virtual Host for WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerAdmin nicolas.ramy@hostname.com | |
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] | |
</IfModule> | |
# END wordpress | |
Options FollowSymLinks | |
Order allow,deny | |
Allow from all | |
</VirtualHost> |
This could help:
<VirtualHost *:80>
ServerAdmin nicolas.ramy@hostname.com
ServerName wordpress.local
# Indexes + Directory Root.
DirectoryIndex index.php index.html
DocumentRoot /var/www/workspace/wordpress/
<Directory "/var/www/workspace/wordpress">
AllowOverride All
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
# 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]
</IfModule>
# END wordpress
LogLevel warn
CustomLog /var/log/apache2/wordpress-access.log combined
ErrorLog /var/log/apache2/wordpress-error.log
</VirtualHost>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Order
andAllow
are valid only in directory and .htaccess context.This configuration if checked (
httpd.exe -t
orapachectl configtest
) you will see this error: