No .htaccess file for “pretty” URLS?
-
Hi
Is bbPress supposed to create an .htaccess file for mod_rewrite URLs? I was expecting this, like in WordPress, but there wasn’t a file after install. Should I just create my own .htaccess?
-
Does “PRetty URL’s” at least work? If so maybe it’s not supposed to…
I too set the pretty permalinks feature to “true” in the config.php file and none of the links lead to an actual page.
Do we need to create a .htaccess file for this? If so what do we put in it.
Sorry I am rewrite stupid.
This is what I am using
# BEGIN BBPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /location_of_install/
Options +MultiViews
</IfModule>
# END BBPress
Copying from this post, by mdawaffe
mod_rewrite:
bbPress can generate a sample .htaccess file for you if you log in and browse to bb-admin/rewrite-rules.php. Copy the output and save it into your .htaccess file. Alternatively, you might be able to forgo the rewrite rules and instead set Options +MultiViews
I gave this a try “bb-admin/rewrite-rules.php”, and it did not work. I get an “Internal Server” error.
The multi views I posted earlier works with no problems. Any suggestions?
I did the “bb-admin/rewrite-rules.php” and all is fine except the “tags” links give me a internal server error.
ergate yours seems to work perfectly.
Its becuase I switched back to Multiviews.
I was giving the other a try, but until I can get it to work I will stick with multiviews.
The rewrite-rules.php file has a few typos. Try this:
NB: those typos are fixed in the latest version available from CVS/SVN.
Sometimes all of these comments are way over my head, so I have to just keep trying and trying…until I figure it out.
I kept having problems with this topic, until finally I figured out the the .htaccess file that should be changed was NOT the one that already existed in my www (root) folder but rather i had to create a NEW .htaccess file and store it in my forum subfolder.
I tried the suggested simple version first (i.e. “Options +MultiViews”), but it would not work on my server. I then used the more complex version to create a new .htaccess file with the following contents:
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /forum/
RewriteRule ^forum/([0-9]+)/page/([0-9]+)$ /forum/forum.php?id=$1&page=$2 [L,QSA]
RewriteRule ^forum/([0-9]+)$ /forum/forum.php?id=$1 [L,QSA]
RewriteRule ^topic/([0-9]+)/page/([0-9]+)$ /forum/topic.php?id=$1&page=$2 [L,QSA]
RewriteRule ^topic/([0-9]+)$ /forum/topic.php?id=$1 [L,QSA]
RewriteRule ^tags/(.+)/page/([0-9]+)$ /forum/tags.php?tag=$1&page=$2 [L,QSA]
RewriteRule ^tags/(.+)/?$ /forum/tags.php?tag=$1 [L,QSA]
RewriteRule ^tags/?$ /forum/tags.php [L,QSA]
RewriteRule ^profile/([0-9]+)/page/([0-9]+)$ /forum/profile.php?id=$1&page=$2 [L,QSA]
RewriteRule ^profile/([0-9]+)/([a-z]+)$ /forum/profile.php?id=$1&tab=$2 [L,QSA]
RewriteRule ^profile/([0-9]+)/([a-z]+)/page/([0-9]+)$ /forum/profile.php?id=$1&tab=$2&page=$3 [L,QSA]
RewriteRule ^profile/([0-9]+)$ /forum/profile.php?id=$1 [L,QSA]
RewriteRule ^view/([a-z-]+)/page/([0-9]+)$ /forum/view.php?view=$1&page=$2 [L,QSA]
RewriteRule ^view/([a-z-]+)$ /forum/view.php?view=$1 [L,QSA]
RewriteRule ^rss/$ /forum/rss.php [L,QSA]
RewriteRule ^rss/forum/([0-9]+)$ /forum/rss.php?forum=$1 [L,QSA]
RewriteRule ^rss/topic/([0-9]+)$ /forum/rss.php?topic=$1 [L,QSA]
RewriteRule ^rss/tags/([a-z]+)$ /forum/rss.php?tag=$1 [L,QSA]
RewriteRule ^rss/profile/([0-9]+)$ /forum/rss.php?profile=$1 [L,QSA]
</ifmodule>
You can see above that I already changed the “/path/to/bbPress/” part into “/forum/” as that is the name of the subfolder on my root directory in which I store my forum (your subfolder name is probably different, so be careful to use the correct name for YOUR subfolder, not mine!).
Put more simply, “forum” is the name of the subfolder in which config.php is stored. So…I created an empty .htaccess file, put the above noted gibberish into the file, then stored the file in the “forum” folder on my server where config.php is already stored.
Now it works like a charm!
Hope that helps some of my fellow newbies out there!
It sure does, thank you.
hi,
how to change “forum/1” by the name of the forum (category) ?
I am a new bbpress user and I have tried it 3 times. Finally I have read the answer of thomasw98, and fixed my system.
thanks a lot…
I put the code of thomasw98 but…
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
why?? I put in my folder a new .htaccess file..
Did you set pretty permalinks to true?
yes! in config.php
A 500 error like you are getting means something is invalid in one of the files you edited. Can you post the config.php and the .htaccess – there’s a syntax error somewhere.
I’m still having that problem. I tried all solutions on this page, but had no luck getting pretty URLs. Forum is working fine, but whenever I apply .htaccess settings, either copy-pasted from this forum or from rewrite-rules.php, I get an error
Not Acceptable
An appropriate representation of the requested resource /forum/topic/1 could not be found on this server.
Available variants:
* topic.php , type application/x-httpd-php, language ru
What could that be? I have the latest version of bbPress, it’s using wordpress database for authorization & authentication, but runs in a separate directory.
ok chrishajer I post now my code
.HTACCES:
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /forum/
RewriteRule ^forum/([0-9]+)/page/([0-9]+)$ /forum/forum.php?id=$1&page=$2 [L,QSA]
RewriteRule ^forum/([0-9]+)$ /forum/forum.php?id=$1 [L,QSA]
RewriteRule ^topic/([0-9]+)/page/([0-9]+)$ /forum/topic.php?id=$1&page=$2 [L,QSA]
RewriteRule ^topic/([0-9]+)$ /forum/topic.php?id=$1 [L,QSA]
RewriteRule ^tags/(.+)/page/([0-9]+)$ /forum/tags.php?tag=$1&page=$2 [L,QSA]
RewriteRule ^tags/(.+)/?$ /forum/tags.php?tag=$1 [L,QSA]
RewriteRule ^tags/?$ /forum/tags.php [L,QSA]
RewriteRule ^profile/([0-9]+)/page/([0-9]+)$ /forum/profile.php?id=$1&page=$2 [L,QSA]
RewriteRule ^profile/([0-9]+)/([a-z]+)$ /forum/profile.php?id=$1&tab=$2 [L,QSA]
RewriteRule ^profile/([0-9]+)/([a-z]+)/page/([0-9]+)$ /forum/profile.php?id=$1&tab=$2&page=$3 [L,QSA]
RewriteRule ^profile/([0-9]+)$ /forum/profile.php?id=$1 [L,QSA]
RewriteRule ^view/([a-z-]+)/page/([0-9]+)$ /forum/view.php?view=$1&page=$2 [L,QSA]
RewriteRule ^view/([a-z-]+)$ /forum/view.php?view=$1 [L,QSA]
RewriteRule ^rss/$ /forum/rss.php [L,QSA]
RewriteRule ^rss/forum/([0-9]+)$ /forum/rss.php?forum=$1 [L,QSA]
RewriteRule ^rss/topic/([0-9]+)$ /forum/rss.php?topic=$1 [L,QSA]
RewriteRule ^rss/tags/([a-z]+)$ /forum/rss.php?tag=$1 [L,QSA]
RewriteRule ^rss/profile/([0-9]+)$ /forum/rss.php?profile=$1 [L,QSA]
</ifmodule>
CONFIG.PHP:
<?php
define(‘BBDB_NAME’, ‘Sql*****_4’);
define(‘BBDB_USER’, ‘Sql*****’);
define(‘BBDB_PASSWORD’, ‘********’);
define(‘BBDB_HOST’, ‘62.149.***.**’);
$bb_table_prefix = ‘bb_’;
$bb->domain = ‘http://www.motiongraphics.it’;
$bb->path = ‘/forum/’;
$bb->name = ‘Motiongraphics Forum’;
$bb->admin_email = ‘info@motiongraphics.it’;
$bb->mod_rewrite = true;
$bb->page_topics = 30;
$bb->edit_lock = 60;
$bb->gmt_offset = +2;
define(‘BBLANG’, ”);
$bb->akismet_key = ‘*********3c’;
$bb->wp_table_prefix = ‘wp_’;
$bb->wp_home = ‘http://motiongraphics.it’;
$bb->wp_siteurl = ‘http://motiongraphics.it’;
if ( !defined(‘BBPATH’) )
define(‘BBPATH’, dirname(__FILE__) . ‘/’ );
require_once( BBPATH . ‘bb-settings.php’ );
?>
Many Thanks!
!!!!!! Maybe I have resolved!!!!!! I set the pretty permalings to false in a config.php!!!!!
That’s a good start. Is it resolved now?
yes it works! thanks!
- You must be logged in to reply to this topic.