Rewriting geeklog topic urls

Saturday, September 11 2004 @ 06:45 AM

Contributed by: Admin

Hacked 2 lines in lib-common eliminating "/index.php?topic="
into
/nameoftopic/

We have a .htaccess document in the root folder that handles the articles, and i added these 2 Mod_Rewrite rules to handle topics as well:

RewriteRule ^(.*)/(.*)/$ /index.php?topic=$1&page=$2 [NC,L]
RewriteRule ^(.*)/$ /index.php?topic=$1 [NC,L]

Please Note: Very important to realise that in order to create new topics, line 1975 in lib-common.php should be in its original state. ie.
$sections->set_var( 'option_url', $_CONF['site_url'] . '/index.php?topic=' . $A['tid'] );

Only when you are happy with your topics and don't plan to add any more can you recode line 1975 to:
$sections->set_var( 'option_url', $_CONF['site_url'] . '/' . $A['tid'] . '/');

The topics are then rewritten to get rid of the question mark. If you need to add another topic, you must replace line 1975 back to its original state, else the topic will not function properly. I don't as yet know of a better way round this problem.



http://modrewrite.gldir.com/20040911064548897.html