Simple Machines Community Forum

SMF Support => Converting to SMF => Topic started by: pgordemer on May 02, 2009, 10:25:06 AM

Title: Rewrite url from snitz to SMF
Post by: pgordemer on May 02, 2009, 10:25:06 AM
I have sucessfully done a converion from snitz to smf (then upgraded to 2.0), but I need some help with URL rewrite.

I am having trouble figuring out the write setup (either apache or iisrewrite) for just get the topic from sniz to smf.

FROM:
http://www.popupportal.com/topic.asp?TOPIC_ID=20897&FORUM_ID=1&CAT_ID=1&Topic_Title=Camp+Driveway+patches+are+here&Forum_Title=General+Camping+Forum
TO:
http://www.popupportal.com/index.php?topic=20897.0

Suggestions?
Title: Re: Rewrite url from snitz to SMF
Post by: SAFAD on May 02, 2009, 02:22:02 PM
i don't think you can make it big bro
maybe if you make or asked someone to make a plugin for this
sorry am not very good at rewrite urls but am not so bad
Best Regards
Title: Re: Rewrite url from snitz to SMF
Post by: niko on May 02, 2009, 03:13:16 PM
Something like this works on .htaccess

I don't know how iisrewrite works.

Idea is to rewrite urls and use 301 redirect (it tells browsers that page has been permanently moved, it's better for search engines since there is no duplicated pages).


RewriteEngine On
RewriteRule ^topic\.asp?TOPIC_ID=([0-9]+) /index.php?topic=$1.0  [L,R=301]
Title: Re: Rewrite url from snitz to SMF
Post by: pgordemer on May 02, 2009, 05:12:18 PM
I will give that a try - my understanding with IISrewrite is that it is 95% compatible .htaccess
Title: Re: Rewrite url from snitz to SMF
Post by: pgordemer on May 03, 2009, 02:02:22 AM
Quote from: Niko on May 02, 2009, 03:13:16 PM
Something like this works on .htaccess


RewriteEngine On
RewriteRule ^topic\.asp?TOPIC_ID=([0-9]+) /index.php?topic=$1.0  [L,R=301]


That did not work. Its not a windows thing as Isapi-rewrite can use a unix .htaccess file
Title: Re: Rewrite url from snitz to SMF
Post by: niko on May 03, 2009, 03:38:09 AM
Quote from: pgordemer on May 03, 2009, 02:02:22 AM
Quote from: Niko on May 02, 2009, 03:13:16 PM
Something like this works on .htaccess


RewriteEngine On
RewriteRule ^topic\.asp?TOPIC_ID=([0-9]+) /index.php?topic=$1.0  [L,R=301]


That did not work. Its not a windows thing as Isapi-rewrite can use a unix .htaccess file

Oops. Didn't remember that RewriteRule doesn't include query string


RewriteEngine On
RewriteCond %{QUERY_STRING} topic_id=([0-9]+) [NC]
RewriteRule ^topic\.asp$ /index.php?topic=%1.0  [NC,L,R=301]


This works and I actually tested it.
Title: Re: Rewrite url from snitz to SMF
Post by: pgordemer on May 03, 2009, 08:56:40 AM
Gold Star!!!! thank you, that worked perfect.
Title: Re: Rewrite url from snitz to SMF
Post by: pgordemer on May 03, 2009, 09:45:06 AM
Where that redirect is completely usefull for snitz conversions is if there is a message with a link to another topic, this will change the format from snitz to smf and correctly show the old message.

Here is my completed .htaccess (This works in linux or windows - assuming windows is running Isapi_rewrite V3)


# Rewrite rules for redirect of old popupport.com snitz forums .asp files.
# Original source credit goes to Niko on simplemachines.org smf conversion forums.
# Be careful if you make changes here, I suggest you only add and
# not remove since even the new forum with old messages might have links in this old format.
# Last change: 05-03-09

RewriteEngine on

# change default.asp to index.php
RewriteRule ^default\.asp$ /index.php [NC,L,R=301]

# convert old snitz topic to smf topic
RewriteCond %{QUERY_STRING} topic_id=([0-9]+) [NC]
RewriteRule ^topic\.asp$ /index.php?topic=%1.0  [NC,L,R=301]

# convert old snitz topic link to smf topic
RewriteCond %{QUERY_STRING} topic_id=([0-9]+) [NC]
RewriteRule ^link\.asp$ /index.php?topic=%1.0  [NC,L,R=301]