Forum Moderators: phranque
Ok, I'll start from the beginning...
I currently have an htaccess file with numerous RewriteRules for spam-spider blocking, image hotlinking etc.
I wish to add a rule to convert urls in my site's forum (PHPBB based) to a search engine friendly path.
I've looked around this forum and found scores of threads dealing with this issue and have ended up simply confused. I've only dealt with mod rewrite on a very basic level, and most of my htaccess file is simple coppied from posts in this forum and modified slightly by me. I've read the basic introduction on htaccess, but I still can't solve a few issues.
A few questions...
1) - I found the following code in a post here which is an example of a similar rule for a CGI based forum. My forum is PHP based, so how would it translate for my situation?
rewriteEngine on
rewriteBase /forum/
rewriteRule (.*)/(.*)/(.*)/(.*)\.htm$ /cgi-bin/forum.cgi?$1=$2;$3=$4 [T=application/x-httpd-cgi]
2) - Can I simply insert this code into my existing htaccess file, or might the RewriteBase line alter my existing rules and muck them up?
Thanks for your help in advance!
Cheers,
Red5 :-)
it is true, that modrewrite can be used to create se-friendly urls for a forum (and other pages), it does not matter wether it's php or any other cgi/sapi/whatever type.
if you want a solution for copy and pasting, then maybe the support site for the forum offers such a solution directly. take a chat with one of the developers and other users/supporter they might can give you more details, because rewrite rules can be very specific and the one you've been posting here shurely might not apply with your forum.
for your 2nd question, yes, there is a specific order of all rewrite rules and they can be combined so others can be mocked up. checkout the [L] flag in the documentation [httpd.apache.org] to prevent this. a collection of docs about mod rewrite is compiled here [modrewrite.com].
- hakre