0

Machine: Mac Book Pro Web Server: Apache

I'm building a Wordpress site locally and I've set it up as a virtual host, I've made the following changes to http-vhosts.conf:

<VirtualHost *:80>
    ServerAdmin webmaster@projectname.dev
    DocumentRoot "/Users/username/Documents/Websites/projectname/index.php"
    ServerName projectname.dev
    ErrorLog "/private/var/log/apache2/projectname.dev-error_log"
    CustomLog "/private/var/log/apache2/projectname.dev-access_log" common
</VirtualHost>

and I've made an entry in the /etc/hosts file as follows:

127.0.0.1       localhost projectname.dev

I've also changed the siteurl and home options in the wp_options table to be http://projectname.dev

but when I access the site via the browser (http://projectname.dev) I just get plain text, the theme/images/stylesheets are not picked up. Looking at the access_log, I can see a whole lot of 404 errors.

Any help appreciated, I've been playing around with it for a while now.

Rgards, Stephen

Stephen
  • 195
  • 1
  • 3
  • 11

1 Answers1

1

Fix your DocumentRoot, it should be the directory, not the file.

DocumentRoot /Users/username/Documents/Websites/projectname/

Can you give us more detail on the errors?

WordPress uses .htaccess to create search engine friendly URL's. This means WP will link to a file that doesn't exist, and have its index script parse and route the request. If .htaccess is not working, then you may have these errors.

Try to add AllowOverride All.

<VirtualHost *:80>
    ServerName projectname.dev
    ServerAdmin webmaster@projectname.dev
    DocumentRoot "/Users/username/Documents/Websites/projectname/"
    <Directory "/Users/username/Documents/Websites/projectname/">
         AllowOverride All
    </Directory>


    ErrorLog "/private/var/log/apache2/projectname.dev-error_log"
    CustomLog "/private/var/log/apache2/projectname.dev-access_log" common


</VirtualHost>
David Houde
  • 3,160
  • 1
  • 15
  • 19