I have a CakePHP site that contains a vanilla Wordpress installation. It lives in /app/webroot/blog/
. The problem I'm having is a strange one.
I have the site configured, through mod rewrite, to redirect all requests to /app/webroot/blog
to /blog/
. The reason for this is that Wordpress was either throwing errors or displaying no content when the user visited it via the app/webroot
path and it works just fine if you visit it at /blog/
. It would also redirect the user to /app/webroot/blog
if they attempted to visit /blog
without a trailing slash, so we added that as well. Here are the mod_rewrite rules we're using to accomplish this:
RewriteRule ^blog$ blog/ [L]
RewriteRule ^app/webroot/blog/(.*)$ blog/$1 [L]
When the user attempts to visit the admin section of Wordpress but is not authenticated, it sends them to the /wp-login.php
page and sends along a query string parameter called redirect_to
that contains the URL the user was originally trying to access before being asked to authenticate. This URL contains the full path (/app/webroot/blog/...
) instead of just going to /blog
, even if the original request was a page within /blog
. If the user successfully authenticates, then the user is sent back to the login page as though nothing happened (no error messages, etc.).
I would assume that the second mod_rewrite rule listed above would rectify the issue, but it doesn't seem to be.
I hope I've explained this thoroughly, please let me know if I can provide additional information that I may have forgotten. Thanks!