开发者

Does WordPress do something that overrides .htaccess?

I'm working locally on a WordPress site for a client. The client keeps their install of wordpress in the server root, but because I have more than one client, I like to install everything in a client folder, like localhost/client. Normally it's a simple matter to add a rewrite rule to .htaccess, setting the rewrite base to be /client/. But today it's not working at all. Even if I put nonsense in the rewrite rule, the site works (which it should not, if the rewrite rules are in effect). The images references are still looking for root at localhost/, instead of localhost/client/, which means they are broken.

I looked into WordPress's documentation and found it has something called WP_rewrite, and there is a place to set parameters for it in wp-includes/rewrite.php). I set the root parameter to client/ but that doesn't seem to have any effect either.

One last thing: there is an .htaccess file in localhost/client/, and another one in localhost/client/wp/. I have them bo开发者_Go百科th set to RewriteBase = /client/, but I've tried just about every other sensible combination--no change.

So my question is: does WordPress do something else that would make the rewrite rules I set in .htaccess not work?


I'd recommend a small change to your local environment for a more flexible solution. Use virtual hosts. If you're running WAMP/MAMP, this tool is readily available to you. It allows you run a directory within your localhost as its own site, which you can access using a local-only URL of your choosing. I have my sites set up as sitename.local, for instance, so they all live in their own happy little ecosystem. Highly recommended.


Yes it does, you have to make some steps that will change entries in db before you move it to subfolder. Here are detailed info: http://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Within_Your_Site

What you need to do:

  1. copy everything as it is setup on your clients server i.e. in root folder
  2. do the steps in above url, important are 4. & 5.; step 10. actually just go to permalink settings and click on "Save" button (or "Update" I do not remember how it says)

Now you can work :) Are you modifying only theme or what?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜