Jason Swett
Jason Swett

Reputation: 45134

WordPress URLs don't work locally

I have a WordPress site running on a production server that I recently copied to my Mac. When I want to view the site on my Mac, I go here and it works fine:

http://localhost/jasonswett.net/web/

But then when I try to view any post it doesn't work. If I go here

http://localhost/jasonswett.net/web/tar-examples/

I get an error that says, "The requested URL /jasonswett.net/web/tar-examples/ was not found on this server."

I know mod_rewrite is enabled because I see it when I do a phpinfo(). My htaccess file is a straight copy from production.

Any idea what the problem could be?

Upvotes: 0

Views: 134

Answers (2)

shelhamer
shelhamer

Reputation: 31160

Have you updated the wordpress location configurations in your database that you copied?

UPDATE wp_posts SET guid = replace(guid, 'http://old.net','http://new.net');
UPDATE wp_posts SET post_content = replace(post_content, 'http://old.net', 'http://new.net');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://old.net', 'http://new.net');
UPDATE wp_options SET option_value = replace(option_value, 'http://old.net', 'http://new.net');

This is a necessary step when moving wordpress from one domain to another, including production to local.

Otherwise, have you checked that your .htaccess on local is being read at all? Try setting a PHP configuration value in it and seeing if it is picked up by phpinfo(). There are a lot of ways this could be wrong: 1. You may need to adjust the ownership of .htaccess to the user your apache runs as with chown and chmod 640 it as well so read permissions will be granted for owner and group. 2. You may need to set the AllowOverride directive in your httpd.conf 3. Check that you have not modified AccessFileName directive.

Last, what happens if you disable permalinks in wordpress?

Upvotes: 2

Chris Henry
Chris Henry

Reputation: 12010

It sounds like the AllowOverride directive is not properly set for that folder. In your Apache configuration, you should make sure that the Directory or Vhost you're using for the primary domain has the AllowOverride set to All

http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride

Upvotes: 0

Related Questions