[geeklog-devtalk] RE topic.php and url conformity

Richard S. Westmoreland richardsw at suscom.net
Sat Dec 25 20:31:45 EST 2004



> --

> I made a copy of index.php and borrowed code from various files, and =

> created a topic.php. If you look at my site you'll observe that when =

> clicking on a topic link, instead of getting =

> /index.php?topic=3Danti-spam, you'll get /topic.php/anti-spam. Not only =

> does this optimize my search engine results for that keyword, but I =

> think it organizes the sections a little better as it now is treated =

> like a directory. With additional tweaks I'm also using the section =

> name as my title tag. I've updated all the code to generate the proper =

> links to use it.

> --

>

> Not to be a pain, but, you could acheive this without the topic.php file

> as

> follows (using .htaccesss):

>

> <IfModule mod_rewrite.c>

> Options +FollowSymLinks

> RewriteEngine on

> RewriteRule topic/(.*)$ /index.php?topic=$1

> RewriteRule .* - [F]

> </IfModule>

>

> I do this with my articles:

>

> <IfModule mod_rewrite.c>

> Options +FollowSymLinks

> RewriteEngine on

> RewriteRule article.php/(.*)$ /article.php?story=$1

> RewriteRule article/(.*)$ /article.php?story=$1

> RewriteRule .* - [F]

> </IfModule>


Sure, but then every page that has to load on your site had to run all of
the code in the .htaccess file. Since I already needed to hack the topics
to write the section name into the title tag, and soon I will be creating
custom templates for the topic pages (that look different than the home
page) - this seemed more efficient.

Rick




More information about the geeklog-devtalk mailing list