News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Rewrite url from snitz to SMF

Started by pgordemer, May 02, 2009, 10:25:06 AM

Previous topic - Next topic

pgordemer

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?

SAFAD

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
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

niko

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]
Websites: Madjoki || (2 links retracted by team, links out of date and taken over.)
Mods: SMF Arcade, Related topics, SMF Project Tools, Post History

WIP Mods: Bittorrent Tracker || SMF Wiki

pgordemer

I will give that a try - my understanding with IISrewrite is that it is 95% compatible .htaccess

pgordemer

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

niko

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.
Websites: Madjoki || (2 links retracted by team, links out of date and taken over.)
Mods: SMF Arcade, Related topics, SMF Project Tools, Post History

WIP Mods: Bittorrent Tracker || SMF Wiki

pgordemer

Gold Star!!!! thank you, that worked perfect.

pgordemer

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]

Advertisement: