How can I avoid repeating DocumentRoot in this Apache virtual host?

Posted by David Faux on Server Fault See other posts from Server Fault or by David Faux
Published on 2012-05-31T16:20:22Z Indexed on 2012/05/31 16:42 UTC
Read the original article Hit count: 362

Filed under:

I have an Apache virtual host configured for a website powered by Wordpress.

<VirtualHost *:80>
ServerName 67.178.132.253
DocumentRoot /home/david/wordpressWebsite

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteCond /home/david/wordpressWebsite%{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

</VirtualHost>

How can I avoid hard-coding /home/david/wordpressWebsite twice? I don't want to use REQUEST_URI since that involves an extra request.

© Server Fault or respective owner

Related posts about apache2