reverse SEO rewrite

New to mod_rewrite? This is a good place to start.

reverse SEO rewrite

Postby some4 » Thu Aug 27, 2009 11:04 am

An upcoming forum switch from vBulletin to Expression Engine forces us to have all our urls to go from this:

http://www.domain.com/forums/categoryti ... 23456.html
to
http://www.domain.com/forums/viewthread/123456/


What rewrite code can we use to achieve this, in order to keep the number?
some4
 
Posts: 11
Joined: Sun Jan 06, 2008 2:32 pm

Postby richardk » Sat Aug 29, 2009 2:33 pm

Try (mod_alias)
Code: Select all
RedirectMatch 301 ^/forums/[^/]+/[^/]+-([0-9]+)\.html$ /forums/viewthread/$1/


or (mod_rewrite)
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^forums/[^/]+/[^/]+-([0-9]+)\.html$ /forums/viewthread/$1/ [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 26 guests

cron