2

We are slowly converting our existing website to a wordpress platform. I currently have 3 directories set up in a subdirectory but these need to look like they are in the site root.

Example: the old site is at http://www.site.com/ but the wordpress base is in http://www.site.com/wp/ so when you are on a category page, instead of looking like http://www.site.com/wp/category it should look like http://www.site.com/category.

That part I have taken care of through the IIS7 URL Rewrite module. The only problem is that all the hyperlinks on the website still point to /wp/ as the base. How do I rewrite the base for only the wordpress files without affecting the rest of the old site? Do I need to modify the web.config file? And if that is the case, do I put the config file in the /wp/ directory or the site root?

Normally I would have our SA do this, but he's out and I need to get these pages live today :(

1
  • i'm going to take that as a no. Nov 7, 2012 at 23:15

2 Answers 2

1

Hope this helps:

We used web.config file and modified it to set URL redirects. That file needs to be in the /wp/ directory of yours. In fact you'll need one web.config file in each folder you're doing redirects for.

1
  • Oh crap, you just reminded me that I was a forgetful jones and didn't post the answer here when I got it worked out! Thanks for that :) I'll do that now. Jun 19, 2013 at 18:57
0

The answer was actually really simple. In the wordpress settings there is a place for a blog URL and physical location URL. All I had to do was put http://www.site.com in the blog URL and http://www.site.com/wp/ for the actual location URL. The only problem with this method is that it will sometimes cause post previews not to work. This will require a bit of URL rewriting to fix. I'm not sure if this is 100%, but it'll look something like this (feel free someone to correct if wrong and I'll update it):

<rule name="preview rewrite">
    <conditions>
        <add input="{QUERY_STRING}" pattern="p=([0-9])&preview=true" />
    </conditions>
    <action type="Rewrite" url="http://www.site.com/index.php?p={C:1}&preview=true" />
</rule>

Also, if your images are in the standard wp-contents/uploads folder you will be giving wordpress-centric URLs all over your website. For this the best option is to put your uploads folder outside of the wp-contents folder. I usually put it in the site root and give it a name like images or assets

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .