Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

mod_rewrite help please

Quote Reply
mod_rewrite help please
I installed our forum at gforum. I want our domain/forum to forward to gforum. Here is my .htaccess file:

RewriteEngine on
Options +FollowSymlinks
Options +SymLinksIfOwnerMatch
RewriteBase /forum
RewriteRule ^\.htaccess$ - [F]

RewriteRule .*P([0-9]+)/?$ /home/httpd/domains/donna_sites/gettingremarried.com/web/gforum/gforum.cgi?post=$1&t=search_engine [L,PT]
RewriteRule .*P([0-9]+)-([0-9]+)/?$ /home/httpd/domains/donna_sites/gettingremarried.com/web/gforum/gforum.cgi?post=$1&page=$2&t=search_engine [L,PT]
RewriteRule .*F([0-9]+)/?$ /home/httpd/domains/donna_sites/gettingremarried.com/web/gforum/gforum.cgi?forum=$1&t=search_engine [L,PT]
RewriteRule .*F([0-9]+)-([0-9]+)/?$ /home/httpd/domains/donna_sites/gettingremarried.com/web/gforum/gforum.cgi?forum=$1&page=$2&t=search_engine [L,PT]
RewriteRule .*C([0-9]+)/?$ /home/httpd/domains/donna_sites/gettingremarried.com/web/gforum/gforum.cgi?category=$1&t=search_engine [L,PT]
RewriteRule ^/?$ /home/httpd/domains/donna_sites/gettingremarried.com/web/gforum/gforum.cgi?t=search_engine [L,PT]
RewriteRule (.*)gforum.cgi /home/httpd/domains/donna_sites/gettingremarried.com/web/gforum/gforum.cgi?%{QUERY_STRING} [NS,L]
~
~

but if I load up http://www.gettingremarried.com/forum I get a Forbidden: you dont have permission to access /forum/ on this server.

also - in my log I get Directory index forbidden by rule: /home/httpd/domains/donna_sites/gettingremarried.com/web/forum/


Any ideas on what could be wrong?

Thanks!
Quote Reply
Re: [adunphy] mod_rewrite help please In reply to
The second path should be from your web directory so instead of

/home/httpd/domains/donna_sites/gettingremarried.com/web/gforum/gforum.cgi?post=$1&t=search_engine

I think it should be

/gforum/gforum.cgi?post=$1&t=search_engine
Quote Reply
Re: [afinlr] mod_rewrite help please In reply to
Thank you for the help. I still get this error message [Sat Feb 7 13:13:35 2004] [error] [client 68.32.167.77] Directory index forbidden by rule: /home/httpd/domains/donna_sites/gettingremarried.com/web/forum/ in my error log and I get a forbidden (403) error.

Here is my new.htaccess
RewriteEngine on
Options +FollowSymlinks
Options +SymLinksIfOwnerMatch
RewriteBase /forum
RewriteRule ^\.htaccess$ - [F]
RewriteRule .*P([0-9]+)/?$ /gforum/gforum.cgi?post=$1&t=search_engine [L,PT]
RewriteRule .*P([0-9]+)-([0-9]+)/?$ /gforum/gforum.cgi?post=$1&page=$2&t=search_engine [L,PT] RewriteRule .*F([0-9]+)/?$ /gforum/gforum.cgi?forum=$1&t=search_engine [L,PT]
RewriteRule .*F([0-9]+)-([0-9]+)/?$ /gforum/gforum.cgi?forum=$1&page=$2&t=search_engine [L,PT]
RewriteRule .*C([0-9]+)/?$ /gforum/gforum.cgi?category=$1&t=search_engine [L,PT]
RewriteRule ^/?$ /gforum/gforum.cgi?t=search_engine [L,PT]
RewriteRule (.*)gforum.cgi /gforum/gforum.cgi?%{QUERY_STRING} [NS,L]

Thanks for any help...
~
~
~
~
~
Quote Reply
Re: [adunphy] mod_rewrite help please In reply to
My config file is pretty complex, but here is the rewrite rules I used on http://beadbanter.com I followed the directions in the search engine templates, but had to make some changes... I don't remember what they were, but this is the "net" result of what is actually in my apache config file.

Code:
RewriteRule ^/$ /cgi-bin/gforum/gforum.cgi?t=search_engine [L,PT]
RewriteRule ^/forum/.*P([0-9]+)/?$ /cgi-bin/gforum/gforum.cgi?post=$1&t=search_engine [L,PT]
RewriteRule ^/forum/.*P([0-9]+)-([0-9]+)/?$ /cgi-bin/gforum/gforum.cgi?post=$1&page=$2&t=search_engine [L,PT]
RewriteRule ^/forum/.*C([0-9]+)/?$ /cgi-bin/gforum/gforum.cgi?category=$1&t=search_engine [L,PT]
RewriteRule ^/forum/.*F([0-9]+)/?$ /cgi-bin/gforum/gforum.cgi?forum=$1&t=search_engine [L,PT]
RewriteRule ^/forum/.*F([0-9]+)-([0-9]+)/?$ /cgi-bin/gforum/gforum.cgi?forum=$1&page=$2&t=search_engine [L,PT]
RewriteRule ^/forum/?$ /cgi-bin/gforum/gforum.cgi?t=search_engine [L,PT]
RewriteRule ^/forum/.*gforum.cgi /cgi-bin/gforum/gforum.cgi?%{QUERY_STRING} [R,NE,L]
RewriteRule ^/gforum.cgi /cgi-bin/gforum/gforum.cgi?%{QUERY_STRING} [R,NE,L]


These are the complete rules I got to work. I don't have any other rewrite rules, or directory aliases, or definitions (other than .htaccess blocks for my admin directories).

I don't have a rewriteBase rule, nor do I have the rewrite rule to forbid the .htaccess, because the cgi-bin location does that automatically. Also my default server, I think, blocks all .filenames

I don't know if this will answer your question, or not.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.