Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
2  
document root shouldn't include the files normally.. –  NickW Apr 5 '13 at 12:06
add comment

closed as off topic by Jenny D, Ward, RolandoMySQLDBA, mdpc, Dennis Kaarsemaker Apr 6 '13 at 11:23

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 1 down vote accepted

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>
share|improve this answer
    
Thanks David, it was the DocumentRoot that was the problem, fixed now. –  Stephen Apr 5 '13 at 12:10
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.