Streaming live at 10am (PST)

301 redirects automation with custom code

Greetings - will appreciate your advice in following matter.

Background: we are migrating our old website (www.labtestsonline.pl) to a new version designed and to be managed in Webflow. Of course would like to keep as much as possible of current traffic and positioning. The site has a simple structure of health related articles, however each one has sometimes good exposure of its own, some even provide substantial traffic. There was some heavy cleanup in data model.

Problem we have identified that the most secure way would be to setup 301s on 1 to 1 basis so old link to new link. Despite Webflows limited capability in this case (no bulk uploads) this still would be manageable on article to article level.

Unfortunately old structure uses vertical aggregation of the content (?tab=1, etc. ) and that would mean setting up about 3000 of 301’s using WF settings. We could use something like # in the syntax *like ignore everything after # and send to…) and make it simpler but WF doesn’t recognize such things.

Solution? So it seems that the only reasonable thing would be to implement custom .js (?) code that would “hijack” incoming traffic form old links/organic search (at least for next couple months) and translate them to new links.

Apparently this could be done via custom code embed element or by using custom code in the page/project head and body areas.

Does any1 here has experience in such approach and could share? We have developers that can easily write such code but I’m mostly concerned with implementation and to avoid any “leaks” that could affect the SEO.

Thanks in advance!

Sew

Hi,

it seems that our idea is working. We have implemented this test script in the header

It captured traffic to old link and translated it to a new one.

What we still don’t know if web crawlers will accept that?

Followup to this thread:

You cannot 301-redirect using just JavaScript, it has to be done server-side.

See this thread for more info: https://stackoverflow.com/q/13846738/584192