Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: No .htaccess file for “pretty” URLS?


Zambu
Member

@thomasw98

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!

Skip to toolbar