Combining CakePHP and WordPress .htaccess rules

I’ve got a problem that seems relatively straightforward but I don’t know exactly how to get mod_rewrite and .htaccess to behave the way I want them to. First off, I have a WordPress install in the /webroot directory of my CakePHP app (in the subfolder “blog”). That works fine, as in, I can access:

site.com/blog/
site.com/blog/about/

etc…

Read More

Since I would like wordpress to power a few static pages on my site, I would like some of these WordPress pages to have “root” level URLs, e.g.
site.com/about (which would actually be the WP page /blog/about)

If I have permalinks turned off on my WP site (i.e. the .htaccess file in /webroot/blog is empty), then this works pretty well. In my /app .htaccess file, I use:

RewriteRule ^about /blog/index.php?page_id=2 [NC,L]

Then I can go to site.com/about and it works. But, I would prefer to use “pretty permalinks” in my WP site, so that once you get to the WP site and you’re clicking around, the links don’t look like “index.php?page_id=…”. The problem is that if I turn permalinks on, when I go to site.com/about it will redirect (i.e. change my address bar) to site.com/blog/about which I don’t really want. If I instead use:

RewriteRule ^about /blog/about [NC,L]

It does take me to my WP site, but with a 404 page not found. I’m guessing this all has something to do with the fact that my rewrite rule is directing to WP, which then applies its own rewrite rules.

So, the bottom line is that I would essentially like to “hardcode” particular URLs like site.com/about and have them be hooked up to WP pages, while preserving the hardcoded URL in the address bar.
Any ideas? Thanks!

Related posts

Leave a Reply

1 comment