View Full Version : mod rewrite for forums?

02-11-2005, 10:30 AM
I have no experience with apache, and don't know how to get mod rewrite installed or working. Can anyone point me to a tutorial or is it something I need to get installed by westhost?

I am entirely clueless on this, but I know I want my forums to show a static.html URL rather than a php string.

02-11-2005, 12:59 PM
Hi, I think the modrewrite is installed by default. To use this feature you need to create a file named ".htaccess" in the directory you want to enable it and write some special commands in it. To learn the commands please check this documentation (http://httpd.apache.org/docs/misc/rewriteguide.html). It isn't easy, so I would suggest you to think more carefully whether you really need it. PHP scripts are executed by the server, so the client just gets an HTML page anyway.

02-11-2005, 11:14 PM
What forum are you useing? Is your concern about SE's and if they well spider your forum?

Like nsc mentioned I would think long and hard about implementing somenting like this. Could be more trouble then it is worth.

02-13-2005, 09:14 AM
we use mod_rewrite on our website to eliminate query strings and make the site more search engine friendly. as far as i know, it's already installed by default. we simply added some rules to the httpd.conf file in the following section:

<VirtualHost *>


i think you need to turn the rewriting on with the following statement:

RewriteEngine on

and then you need to add in your rules. this is quite a good article to get you started:


everyone warned us against getting involved in the black art of mod_rewrite but it was actually quite simple in the end. maybe that's because we are only doing fairly simple things with it. beware though, it can get very complicated and have unforseen knock on affects if you don't know what you're doing. back up any files you edit first!

good luck!

02-13-2005, 10:42 AM
Yes rogoff is correct that you need to use the Rewriteengine On entry in your .htaccess files. Here is an example of use often used when folks want to protect their image files from being linked to by other sites. It may give you an idea of what you are looking at.

Rewriteengine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://domain.com/alternate.gif [R,NC]

02-14-2005, 08:44 AM
I am using a modified phpBB2.

My goal is to help with SEO and get the forum pages spidered and indexed effectively.

Thanks for the advice so far.

02-14-2005, 04:44 PM
It seems like I remember reading a thread on the phpBB board that had info on what to use in mod_rewrite but not sure where it is anymore. It could also have been at one of the other sites like phpbbhacks. I use a heavily modded version of phpBB and have very little problems with being spidered. In fact seems like the googlebot is checking my forums about every few days. The only changes I have made are the ones recomended for sessions but I also think those have been added in by default to the newest version or at least something similiar.

If I can find direct links to the mod_rewrite I'll post them for you.

02-15-2005, 07:17 AM
Thanks. I really appreciate it.

02-15-2005, 12:28 PM
I think I have found what you are looking for. This is a mod that is not on the phpBB site so not sure how great or reliable it may be but you might want to give it a look.
At the top of the page you'll see a link to his forums and it has more info on optimizeing phpbb for search engine review. Give it a look over and let me know if it raises any questions for you. Seems to be pretty straight forward. Not sure what version of phpBB he is using since it is not listed on his sight but I did not see anything with a quick look that would keep the mod from working with the 2.0.11.