Another pretty permalink/mod_rewrite mystery
-
I have bbPress installed in a directory called “forums” on my web server. I have Pretty Permalinks enabled and working. To view the profile of a member, I can go to this URL:
http://www.example.com/forums/profile/membername
However, I would like the url to be:
http://www.example.com/profile/membername
I’ve tried writing a mod_rewrite rule which rewrites the latter to the former. However, instead of rewriting it, it redirect and exposes the URL. For example. Typing this into the browser:
http://www.example.com/profile/membername
Redirects to this, instead of rewriting it:
http://www.example.com/forums/profile/membername
Here is the mod_rewrite I am using:
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymlinks
RewriteRule ^profile/membername$ /forums/profile/membername [L]
</IfModule>If I change the rule to rewrite the URL to a simple text file, it rewrites properly and masks the URL. For example, this works:
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymlinks
RewriteRule ^profile/membername$ /forums/textfile.txt[L]
</IfModule>Another example, I wrote this rule, as a test, to rewrite a URL to the rewrite-rules.php file:
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymlinks
RewriteRule ^profile/membername$ /forums/bb-admin/rewrite-rules.php [L]
</IfModule>I type in this url into my browser:
http://www.example.com/profile/membername
And it redirects to ths instead:
http://test.doublebad.com/forums/
If I replace all the text in the rewrite-rules.php file with “test text”, then the URL rewrites properly.
So it seems that when you are rewriting and URL to a bbPress php file, it will always redirect instead of rewriting, which is quite annoying. I’m trying to trace in the bbPress functions and settings where this is occuring. But I’m having no luck.
Any suggestions?
- You must be logged in to reply to this topic.