This will replace only first match `.` you need `.split('.').join('/')` instead.