开发者

WordPress File Set-up on Localhost and Production Server

UPDATE: I've got MAMP Pro. Should I simply set-up another virtual host on my local machine. If I created another virtual host, then I could put the wordpress files in its root. And when I upload to the production server, I wouldn't have to make any changes. I could place the files in开发者_开发问答 the production server's root, as well. Would this plan work? Thank you.

-Laxmidi

Hi,

I've got a simple question about using WordPress on my localhost. I've got MAMP on my localhost; and I put the WordPress files in a directory like so: htdocs/wordpress.

When I deploy WordPress to the production server, I want to put it in the root directory. (I want to ditch the wordpress directory).

Can I simply copy the files that are in the wordpress directory on my localhost and dump them in my production server's root? Or will this screw-up settings and filepaths?

I've got a bunch of files in my localhost's htdocs directory. I don't want to confuse them with other projects. Otherwise, I'd mirror the set-up on both machines.

Sorry for such a basic questions. But, I'd rather get it set-up correctly so as to avoid problems down the road.

Thank you.

-Laxmidi


You can copy the whole directory structure to htdocs on your production host however you will need to change some URLs. Please follow this guide to change URLs directly in database.


To keep the web root tidy on your production server, you can keep WordPress in its own directory while rewriting the URLs as though it was in the web root. You can set this up in MAMP too, so you will end up with an identical configuration.

All you need is to modify a copy of the index.php and .htaccess files and place them in your web root, then tell WordPress that the WordPress URL is in the subdirectory and the site URL is the web root, in Settings -> General.

Detailed instructions can be found in the WordPress Codex.

Regarding your update, if you want to be able to copy everything as it is, you could temporarily add an entry to your hosts file to route the URL of your production server to your MAMP server. Then configure WordPress with the production server's URL.


You have to change the settings in wp-config.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜