About the URLs in THIS forum

Discuss practical ways rearrange URLs using mod_rewrite.

Postby Brett » Fri Jul 13, 2001 10:09 pm

Yes, I used mod_rewrite to change the URL's right here in this forum! Here's the code I used in my .htaccess file:
Code: Select all
RewriteEngine on

# View Category
RewriteCond %{REQUEST_URI} ^/c([0-9]*)
RewriteRule ^(.*) index.php?viewcat=%1  [L]

# View Forum
RewriteCond %{REQUEST_URI} ^/f([0-9]*)-([0-9]*)
RewriteRule ^(.*) viewforum.php?forum=%1&%2  [L]

# View Topic -- after first page
RewriteCond %{REQUEST_URI} ^/t([0-9]*)-([0-9]*)-([0-9]*)-([0-9]*)
RewriteRule ^(.*) viewtopic.php?topic=%1&forum=%2&start=%3&%4  [L]

# View Topic -- first page
RewriteCond %{REQUEST_URI} ^/t([0-9]*)-([0-9]*)-([0-9]*)
RewriteRule ^(.*) viewtopic.php?topic=%1&forum=%2&%3  [L]

This code assumes that phpBB is installed in the topmost public HTML directory. If it had been installed in, say, forum/, I would have used RewriteCond %{REQUEST_URI} ^/forum/c([0-9]*), etc.

And of course, I had to modify a bunch of the phpBB code to point toward the new URL's. Comments?

<font size=-1>[ This Message was edited by: Brett on 2001-07-14 13:37 ]</font>

<font size=-1>[ This Message was edited by: Brett on 2001-07-14 13:38 ]</font>
Brett
 
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm
Location: yohost.com

Postby Guest » Mon Feb 04, 2002 5:29 pm

Ahhh, that's the ticket. I have a dynamic site to rewrite and make search engine friendly, so that idea is just the ticket for it.

Thanks,

Richard Bolt
---------------
http://www.texmate.com
Guest
 


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 2 guests

cron