I have a plugin "Theme My Login" for WordPress 3.0.1 which causes my user's profile pages to be here:
domain.com/login-2?action=profile
instead of here:
domain.com/profile
So I am trying to fix it with mod_rewrite like this:
RewriteRule ^profile /login-2?action=profile
But it seems to do nothing. I suspect it's some we开发者_StackOverflowird thing happening in WordPress but wanted to ask folks here if my rewrite rule looks correct before I dig further. Did I do it right?
By default, I believe that WordPress uses the value of REQUEST_URI
when routing the request. Your rule
RewriteRule ^profile /login-2?action=profile
...should correctly rewrite /profile
to /login-2?action-profile
, but WordPress will not observe this change because the value of $_SERVER[REQUEST_URI]
in PHP is based on the original request send to the server.
It might be possible to work around this by getting WordPress to use PATH_INFO
instead through modification of the default WordPress permalink block:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php/$0
It's also possible to use the P
flag to proxy the rewritten request through, which will update the REQUEST_URI
. It comes with the overhead of creating a new request, so I'm not sure if I'd recommend it:
RewriteRule ^profile /login-2?action=profile [P]
精彩评论